Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Printing Values of Resultset to Html Table
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ambica Pradeep
Printing Values of Resultset to Html Table
2 Answer(s)      3 years and 7 months ago
Posted in : JSP-Servlet


I have a resultset and I need to collect the resultset values into the arraylist into a table.

arraylist also contains timestamp values.

Please help me in this

regards Thanks in advance


Advertisement
View Answers

February 24, 2011 at 10:42 AM


JSP Display values of ResultSet to HTML table:

<%@page import="java.sql.*"%>
<table border=1>
<tr><th>Name</th><th>Address</th></tr>
<%
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from data");
while(rs.next()){
%>
    <tr><td><%=rs.getString("name")%></td><td><%=rs.getString("address")%></td></tr>
<%
}
rs.close();
st.close();
con.close();
}
catch(Exception e){}
%>
</table>


November 26, 2012 at 7:55 PM


i have a senario where i have a combo box which has certain departments.. and when the user selects an option.. then the relevatn doctors belonging to that department should be displayed.. cuz for the one above.. it displays only one value.. i want all the values to be displayed... plz



Related Tutorials/Questions & Answers:
Printing Values of Resultset to Html Table
Printing Values of Resultset to Html Table  I have a resultset and I need to collect the resultset values into the arraylist into a table... in advance   JSP Display values of ResultSet to HTML table: <%@page
inserting all the values in a html table column
inserting all the values in a html table column  strong text hai everyone, i'm a fresher to servlet i need to know that, how can i insert all the values in a html table column into a database. Thanks in advance
Advertisements
large resultset values - SQL
large resultset values  i have one query which will bring more than one lakh records from database(total records are abt 3 crores). While getting the details i'm getting error like
how to update values of a html form into an excel table using java servlets?
how to update values of a html form into an excel table using java servlets?  i have written a java servlet program, which has a html form... table ,but my program is working till generation of receipt and the values
how to load values of html form into an excel table using java servlet?
how to load values of html form into an excel table using java servlet?   i have written a java servlet program, which has a html form to be filled. after filling the form the servlet generates a receipt and the values should
Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database
Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database  Hi members, I have one Html table in jsp page and i am iterating values (in columns of html table)from
How to Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database(MySql)?
have one Html table in jsp page and i am iterating values (in columns of html table)from Database, Now i am Dragging and dropping one HTML table row to another...How to Dragging and dropping HTML table row to another position(In Jsp
disallow NULL values in a table.
disallow NULL values in a table.  How do I disallow NULL values in a table
ResultSet
ResultSet   What is a ResultSet
ResultSet
ResultSet  What is a ResultSet
ResultSet
database.how to do it using resultset or Resultsetmetadata.Can you please tell me what to write in the dashes specified. <%@page contentType="text/html...="Content-Type" content="text/html; charset=UTF-8"> <title>SQL<
HTML Table in javascript
HTML Table in javascript  hi all, how to add last row with sum in table using javascript
HTML table layout
HTML table layout  i have table layout in that i have menu in td(column) ,when i click menu item ,the page will be open in that table right side td... requirement is layout using table
inserting dropdown values into database table
inserting dropdown values into database table   hi i want to insert dropdown values into a database table by using jsp
Imp-HTML Table Sorting
Imp-HTML Table Sorting   Hi, I am working on a project and as per requirement from client i have to sort a table based on the ID Column. I want... of HTML table sorting where sorting happenes whenever user clicks on column header
HTML - table background color.
HTML - table background color. Description : Here, you will see how to specifies the table back ground color in html page. The <table > is a html... the background color of table.  Code : <!DOCTYPE html PUBLIC "
dispalying arraylist values in table form
dispalying arraylist values in table form  My result is in arraylist and i want to display it in table form using iterator tag
html table without border
html table without border  How to create a html table without border?   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN..." content="text/html; charset=utf-8" /> <title>Table without borders<
Table Heading in HTML
Table Heading in HTML       The Tutorial illustrates an example to create a Table in HTML... The Tutorial illustrates an example  from Table Heading in HTML
Table Heading in HTML
Table Heading in HTML       The Tutorial illustrates an example to create a Table in HTML... The Tutorial illustrates an example  from Table Heading in HTML
JDBC ResultSet Example
("ColumnName");, You can update the database table from the resultSet...; } JDBC ResultSet Example JDBC ResultSet is an interface of java.sql package. It is a table of data representing a database query result, which
How to Display values from databse into table
How to Display values from databse into table  I want to display values from database into table based on condition in query, how to display... based on either bookname or authorname, for this i created one html page
HTML & MYSQL - retrieve record from table
table. Actually they are separated by comma. I want to take the values as single...HTML & MYSQL - retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
retrieve record from table and show it in HTML
the field table. Actually they are separated by comma. I want to take the values...retrieve record from table and show it in HTML  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai
Tag Inside Table in HTML
Tag Inside Table in HTML     ... in HTML.In this code we define a HTML page and show you to create a tag inside a Table in HTML. The following tags used in code to create tag inside table in HTML
Inserting values into a database table of selected DropDown in jsp.
Inserting values into a database table of selected DropDown in jsp.  ... to insert all selected values in data base correspondent to each like if user selected india and then goa. I want to insert it to a table which has two fields
Table Empty Cell in HTML
Table Empty Cell in HTML       The Table Empty Cell in HTML define no content inside a cell... from Table Empty Cell in HTML. In this Tutorial we create a Empty cell in HTML
to upload a table from DB to the same html page
to upload a table from DB to the same html page  how to make this booklist table to be opened in the same html page itself using a third frame
HTML table example
HTML Table example In this page we will learn how to use HTML table tag with the help of examples. HTML table tag is used to display the data into tabular form on the web page. Here is an example of HTML Table
Inserting values in MySQL database table
Inserting values in MySQL database table   ... insert values in the MySQL database table. We know that tables store data in rows... the facility for inserting the values in MySQL database table. Description
 

 

 

DMCA.com