Hi all,

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

is it possibile to create gridview in jsp page?

please help

<%

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

        }
       }

        %>

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

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