阅读背景:

如何在jsp中编写一个函数,可以在单击提交按钮时调用该函数

来源:互联网 

I have the following code:

我有以下代码:

<tr>
        <td>Text:</td>
        <td><input type="text" name="myText" id="myText" value=""></td>
        <td><input type="button" value="Click to Submit"></td>
</tr>

    <%

    String selectSQL = "select * from INTERFACE where INTERFACE_SHORT_NAME='?'";

    try{

         Class.forName("oracle.jdbc.driver.OracleDriver"); 
         Connection connection = DriverManager.getConnection(
         "jdbc:xyz:thin:@abc:1521:pqr", "user", "pw");

          PreparedStatement statement = connection.prepareStatement(selectSQL) ;

          statement.setString(1,request.getParameter("myText"));

          ResultSet resultset = statement.executeQuery();             

%>

    <TABLE BORDER="1">
        <TR>
            <TH>INTERFACE_SHORT_NAME</TH>
        </TR>
        <% while(resultset.next()){ %>
        <TR>
            <TD><%= resultset.getString("INTERFACE_SHORT_NAME") %></td>
        </TR>
        <% } %>
    </TABLE>
    <%  }
      catch(SQLException e){
                             System.out.println("Class not found ");  
                            }  
%>

</body>
</html>
<tr>
   



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: