如何在单击“提交”按钮后将frame1.jsp中的文本框中的值传递给frame2.jsp

时间:2012-10-23 09:09:09

标签: javascript html jsp frameset

我有一个index.jsp,frame1.jsp被调用,我需要在单击Submit按钮进行数据库连接后,将文本框中的值从frame1.jsp传递给frame2.jsp。我遇到错误。请帮助。

的index.jsp

<frameset rows="18%,*">
          <frame src="frame1.jsp" name="frame1" scrolling="no">  
            </frameset> 

frameset1.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>

frameset2.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);
                }
            %>

0 个答案:

没有答案