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



Home Answers Viewqa JDBC Help on JSP and JDBC

Have Programming Question? Ask it here!
 
 
 


Manoj Kumar Singh
Help on JSP and JDBC
2 Answer(s)      6 years and 4 months ago
Posted in : JDBC


Retrieve data from Database in JSP and JDBC connection.


Advertisement
View Answers

April 2, 2008 at 8:51 PM


retrivedata.jsp

<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>
<html>
<head>
<title>Retrive value from database</title>
</head>
<body>
<table border="0" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<h2><font color="#FF0033">Retrive data from database</font></h2>
<form method="POST" >
<table border="1" width="50%" cellspacing="0" cellpadding="0" bgcolor="#66FFCC">
<tr>
<td width="50%" valign="right"><b>ID</b></td>
<td width="50%" valign="right"><b>Employee Name</b></td>
<td width="50%" valign="right"><b>Position</b></td>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String query = "SELECT * FROM emp_details";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
%>

<tr>
<td width="50%" valign="right"><%=rs.getInt("empno")%></td>
<td width="50%" valign="right"><%=rs.getString("empname")%><br/></td>
<td width="50%" valign="right"><%=rs.getString("job")%><br/></td>
</tr>
<%
}
rs.close();
con.close();
}
catch(SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}
%>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>


April 8, 2008 at 4:04 PM


hi friend,
jsp only for view , we should use for presentation don t combine databse code and jsp, it is not good approach,use separate class for connection from that class get values.

jsp only for view , even html designers can do this, we are java programmers keep mind


Related Tutorials/Questions & Answers:
Help on JSP and JDBC - JDBC
Help on JSP and JDBC  Retrieve data from Database in JSP and JDBC...;% Connection con = null; String url = "jdbc:mysql://localhost:3306/"...;hi friend, jsp only for view , we should use for presentation don t
Help on JSP - JDBC
Help on JSP  Sir I am makeing a project name Online reservation and Enquiry system. I had completed the front end design with the help of html,delete and search the database from the html file with the help of JSP.  hi
Advertisements
Jsp,JDBC - JDBC
Jsp,JDBC  Write a Program using Servlet,JSP, JDBC and XML to create a web application for a courier company to provide an online help in tracking the delivery status of items.  Hi friend, For solving the problem
JDBC in JSP - JDBC
JDBC in JSP  Sir, I got a problem in my jsp page which contains... happening for my update query. Please help me with a suitable suggeastion. Regards Sreejith  send me your jsp coding then i can understand what
JDBC with JSP
JDBC with JSP  how to get a combo box value and pass it to the java method in a jsp program dynamically, without moving to servlet or next page
JSP help
JSP help  Hi i am using jsp,html and mysql. I am displaying one question & their 4 options per page. For that i have one label for question &... do this? Please Help
jsp help
jsp help  Hi i am doing my project in jsp.using netbeans 6 and mysql 5.0. and i managed to complete it. and now its submission time. but am confused... with it. so that my project can run independently in any server. plz help me. am so
jdbc,jsp - JDBC
jdbc,jsp   this is my jsp code in this code i have to give hyperlink to database(selected row must be deplay)  Hi keerthi, replace the line
Help on JDBC and my SQL 5 database - JDBC
Help on JDBC and my SQL 5 database  Dear Sir, I had create a statement for the JDBC as shown below: try... the connection c = DriverManager.getConnection ("jdbc:mysql
JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
jsp - JDBC
jsp  My code is not working please anyone help me to store retrieved... variable. JSP Page... Login Successful <%-- <jsp:forward page="studenthome.jsp"/>
jsp-jdbc - JDBC
jsp-jdbc  Hi! html- jsp-jdbc program from the html form where... jsp frequently. I am getting error through request.getParameter(). can you please...="DriverManager.getConnection("jdbc:odbc:ashokdb","scott","tiger"); Statement st
jsp - JDBC
JSP Storing Data, Datatype vale in SQL   Storing Data, Datatype vale...;<%Connection con = null; String url = "jdbc:mysql://localhost:3306..., will help you in storing date in sql database.See how to insert data from html
jsp - JDBC
jsp  I have one jsp code.but it is included oracle databse...("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle... = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle","scott","tiger"); I
JSP - JDBC
JSP Store Results in Integer Format  JSP Example Code that stores the result in integer format in JSP  Hi! Just run the given JSP Example...;/b></td><% Connection con = null; String url = "jdbc:mysql
jsp - JDBC
jsp  -------------------------------------------------------------------------------- how to receive data into jsp from html for dropdown boxes
jsp - JDBC
jsp  i am doing project in java using jsp as font end and microsoft access as back end my project airline ticketing reservations how can i give hyperlink to database rows in jsp code.   First
jsp - JDBC
jsp  how to link jsp code with next htmlcode.  Hi keerthi, Can u explain ur question clearly? What is your exact Requirement
urgent help needed in JDBC AND JAVA GUI - JDBC
urgent help needed in JDBC AND JAVA GUI  my application allows... want any one to help me convert from scanner to java GUI for this code...(); } } // thanks for any help rendered   Hi Friend, Try the following code
jsp - JDBC
about update at http://www.roseindia.net/jsp/implement-javascript
jsp - JDBC
: Unable to compile class for JSP An error occurred at line: 20 in the jsp file...\localhost\Airlines-Project\org\apache\jsp\Flightdetails_jsp.java:69: cannot find symbol symbol : variable src location: class org.apache.jsp.Flightdetails_jsp
jsp help - JSP-Servlet
jsp help  hai friends i am using videos,which will play on my webpage using flowplayer.my doubt is where will i store my videos whether in the database or in another local folder. please help me as soon as possible thanks
jdbc-jsp
jdbc-jsp  <html> <head> <title>your info mail</title> </head> <body bgcolor=#FAEBD7> <center><u>... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root
JSP and JDBC - JSP-Servlet
JSP and JDBC  Respected sir/Madam, I am R.Ragavendran.. I... for JDBC codings must be present.. NOTE: When User clicks Insert,for example...; IF I GET THIS HELP IN TIME.... Thanks/Regards, R.Ragavendran.
JSP-Servlets-JDBC
be JSP-->Servlet-->JDBC-->Services-->JSP 3, Update - The table created... if we give the form ID in a JSP and submit delete. Please help me...JSP-Servlets-JDBC  Hi all, 1, Create - i want sample code
jsp help - JSP-Servlet
jsp help  i want to add n remove rows dynamically and also want to add data in database in jsp ....  Hi Friend, Try the following code: 1)table.jsp: Add/Remove dynamic rows in HTML table function
jsp help - JSP-Servlet
jsp help  In below code value got in text box using 'ID' Attribute ... I want to use that value in query to fetch related values in same page...://www.roseindia.net/jsp/comboSelect.shtml Thanks
jsp help - JSP-Servlet
jsp help  i got below code for dynamically add n delete row... but in my table there are 17 colum in 1 row..i want to add whole row with 17 cloum.. so which changes are required??? 1)table.jsp: Add/Remove dynamic
Query regarding JSP, JDBC
Query regarding JSP, JDBC  can I get the code for the question asked by me regarding JSP,JDBC
Programming in JDBC and JSP - JSP-Servlet
Programming in JDBC and JSP  Write a program using JDBC and JSP to display the names and addresses of all those MCA students at your study centre... Semester.   Hi friend, Code to help in solving the problem
help me - JSP-Servlet
help me   how to open one compiled html file by clicking one button from jsp
Java JSP - JDBC
Java JSP  JDBC connectivity in JSP?  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml Hope that it will be helpful for you. Thanks
jsp jdbc Spring
jsp jdbc Spring  I need to create the form in jsp with one field.The field is user id. On submitting the form all the details associated... how to link the user id field of jsp with the database using spring mvc
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have been given an assignment where I have to fix existing issues in the tool(created using JAVA JSP). e.g. Tool does not adjust with the resolution of the screen
help on project - JSP-Servlet
help on project  Need help on Java Project
JSP-jdbc validation - JSP-Servlet
JSP-jdbc validation  How to validate login email id using JSP, where..., login application in jsp function validateForm(theForm... for more information. http://www.roseindia.net/jsp/valid-email
please help in jsp - JSP-Servlet
please help in jsp  i have two Jsp's pages. on main.jsp have some... data. here some data of Jsp's. main.jsp... please help.  Hi Friend, Try
please help - JSP-Servlet
with others combox values. Here is JSP's files: display.jsp... To Year "> please help
Help needed in JSP
Help needed in JSP  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
help me to do it in jsp
help me to do it in jsp  if we click on a topic it should direct to another page in separate window i need to create a part of the web page which... to insert and update the topics via admin page. pls help me to do
jdbc connectivity through jsp
jdbc connectivity through jsp  my code: <%@ page language="java... = ""; String url = "jdbc:mysql://localhost/interviewer... org.apache.jasper.JasperException: An exception occurred processing JSP page /mypage.jsp
Please Help - JSP-Servlet
Please Help  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your response.. You told me that its difficult to handle the problem.. Ok,Let me try my hands on it.. The help i need is can u please tell me
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form which allows the user to enter a question, this question is then saved...;title>JSP Form</title> <style> </style>
 

 

 

DMCA.com