我有一个 index.jsp,调用了 frame1.jsp,我需要在单击提交按钮后将文本框中的值从 frame1.jsp 传递到 frame2.jsp 以建立数据库连接。我这样做时遇到了错误。请帮助。
索引.jsp
<frameset rows="18%,*">
<frame src="frame1.jsp" name="frame1" scrolling="no">
</frameset>
框架集1.jsp
<td width="15%"><b>
<font color="#FFFFFF" size="3">ADSL Number
<input name="ADSLNO" type="text" />
<input name="Submit" type="submit" value="Confirm" />
</font></b></td>
</tr>
</table>
</form>
<frameset cols="100%,*">
<frame src="frame2.jsp" name="frame2">
<noframes><body>No frame! </body></noframes>
</frameset>
框架集2.jsp
</body>
<%
String ADSL = request.getParameter("ADSLNO");
if(ADSL!= null)
{
String connectionURL = "jdbc:mysql://10.152.31.82/poller";
Connection connection = null;
String buffer = "<div class='divTable'>";
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "dipadm", "dipadm123");
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select DT, PROFILE, DS_BW, SNR_DW, AT_DW, UCE, MODEL, CRC, RETRAIN from scanProfileData where ADSLNO='" + ADSL + "' order by DT DESC;");
if (rs != null) {
buffer="<div class='divRowh'><div class='divCellDT'>DATE/TIME</div>" ;
buffer=buffer+"<div class='divCellPROFILE'>PROFILE</div>";
buffer=buffer+"<div class='divCellBANDWIDTH'>BANDWIDTH</div>";
buffer=buffer+"<div class='divCellSNR'>SNR</div>";
buffer=buffer+"<div class='divCellATTENUATION'>ATTENUATION</div>";
buffer=buffer+"<div class='divCellCRC'>CRC</div>";
buffer=buffer+"<div class='divCellUCE'>UCE</div>";
buffer=buffer+"<div class='divCellMODEL'>MODEL</div>";
buffer=buffer+"<div class='divCellRETRAIN'>RETRAIN</div></div>";
while(rs.next()){
buffer =buffer+"<div class='divRow'>"
+"<div class='divCellDTr'>"+rs.getString("DT")+"</div>"
+"<div class='divCellPROFILEr'>"+rs.getString("PROFILE")+"</div>"
+"<div class='divCellBANDWIDTHr'>"+rs.getString("DS_BW")+"</div>"
+"<div class='divCellSNRr'>"+rs.getString("SNR_DW")+"</div>"
+"<div class='divCellATTENUATIONr'>"+rs.getString("AT_DW")+"</div>"
+"<div class='divCellCRCr'>"+rs.getString("CRC")+"</div>"
+"<div class='divCellUCEr'>"+rs.getString("UCE")+"</div>"
+"<div class='divCellMODELr'>"+rs.getString("MODEL")+"</div>"
+"<div class='divCellRETRAINr'>"+rs.getString("RETRAIN")+"</div></div>";
}
}
buffer=buffer+"</div>";
response.getWriter().println(buffer);
}
%>