0

Hi all,

How to display search results from MYSQL database in JSP page??

is it possibile to create gridview in jsp page?

please help

3
Contributors
5
Replies
10
Views
5 Years
Discussion Span
Last Post by anand01
0

<%

   try{
        Class.forName("org.apache.derby.jdbc.ClientDriver");
        con=DriverManager.getConnection("jdbc:derby://localhost:1527/Employee");
       stmt=con.createStatement();
        ResultSet rs=stmt.executeQuery("select uname,regno from emptbl");

        while(rs.next()){
            %>
            <table>
            <tr>
                <td>rs.getString(1)</td>  // 1 indicates coloum number(uname)
                <td>rs.getString(2)</td>
            </tr>   
            </table>

            <%
            } 
      }
     catch(Exception e)
             {
         }
      finally
              {
              try {
                   stmt.close();

                con.close();
            }

         catch (Exception ex) {

        }
       }

        %>
0

html table will be the perfect choice, but dont code logic in jsp ,it just view purpose,
check this link

0

It can be easily rendered using JSTL for loop tag
but still you have option like that check this link

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.