Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

make a table of data from db in jsp

<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
<HTML>
       <HEAD>
       <TITLE>The View Of Database Table </TITLE>
       </HEAD>
       <BODY BGCOLOR="cyan">
       <H1>The View Of Database Table </H1>
       <%
           Connection connection = DriverManager.getConnection(
            "jdbc:odbc:data");
           Statement statement = connection.createStatement() ;
          ResultSet resultset = statement.executeQuery("select * from table1") ;
       %>
      <TABLE BORDER="1">
      <TR>
      <TH>ID</TH>
      <TH>Name</TH>
      <TH>City</TH>
      <TH>State</TH>
      <TH>Country</TH>
      <TH>Email</TH>
      <TH>Interest in Game</TH>
      </TR>
      <% while(resultset.next()){ %>
      <TR>
       <TD> <%= resultset.getString(1) %></td>
       <TD> <%= resultset.getString(2) %></TD>
       <TD> <%= resultset.getString(3) %></TD>
       <TD> <%= resultset.getString(4) %></TD>
       <TD> <%= resultset.getString(5) %></TD>
       <TD> <%= resultset.getString(6) %></TD>
       <TD> <%= resultset.getString(7) %></TD>
      </TR>
      <% } %>
     </TABLE>
     </BODY>
</HTML>
 
PREVIOUS NEXT
Tagged: #table #data #db #jsp
ADD COMMENT
Topic
Name
5+1 =