Hi all,

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

is it possibile to create gridview in jsp page?

please help

Recommended Answers

All 5 Replies

<%

   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) {

        }
       }

        %>

thanku for ur codes..

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

datagird option is possible?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.