TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Harshita Kansra
NA
1
2.7k
how to display data of database on html page using jsp
Nov 23 2013 8:42 AM
how to display data of database on html page using jsp using netbeans
i have tried something but stuck
<%Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");%>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String n=request.getParameter("button");
if(n.equals("SHOW TABLE"))
{
try{
Connection con = DriverManager.getConnection("jdbc:odbc:t");
String id = request.getParameter("id");
String sql = "Select * from [table1] where id = '" + id + "'";;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery( sql );
}catch(Exception e) {}
}
%>
<TABLE BORDER="1">
<TR>
<TH>ID</TH>
<TH>Name</TH>
</TR>
<TR>
<TD> <%= rs.getString(1) %> </TD>
<TD> <%= rs.getString(2) %> </TD>
</TR>
</TABLE>
<BR>
<%
}
%>
</body>
</html>
Reply
Answers (
1
)
Regarding jsp
retrieve select dropdown option value into sql query