jsp object retrieval

jsp object retrieval

View Answers

May 28, 2008 at 9:29 PM

Hi friend,

<%@ page language="java" import="java.sql.*" %>

<html>
<head>
<title>Retrive value from database</title>
</head>
<body>
<table border="1" width="75%" 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="100%" cellspacing="0" cellpadding="0" bgcolor="#CCFFCC">
<tr>
<td width="50%"><b>User id:</b></td>
<td width="50%"><b>Course Name</b></td>
<td width="50%"><b>Courese Fee</b></td>
<td width="50%"><b>Faculty Name</b></td></tr>
<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"amar","amar123");
try{
Statement st = con.createStatement();
String query = "SELECT id,coursename,couresefee,facultyname FROM student where id=id";
ResultSet rs = st.executeQuery(query);

while (rs.next()) {
String coun=rs.getString(1);
String coun1=rs.getString(2);
%>
<tr>
<td width="50%"><%=coun%></td>
<td width="50%"><%=coun1%></td>
<td width="50%"><%=rs.getString("couresefee")%></td>

<td width="50%"><%=rs.getString("facultyname")%></td></tr>

<%}

out.println("<br/><a href=RetriveForm.jsp><b>Insert Data page</b></a>");
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>


----------------------------------

Read for more information.

http://www.roseindia.net/jsp/

May 28, 2008 at 9:43 PM

Thanks for the reply but I want to keep the java code out of the jsp.









Related Tutorials/Questions & Answers:
jsp object retrieval - Spring
jsp object retrieval  I have a controller which calls a Service to build a List of data from the database. I want to pass the List to the jsp to use.... However, I am concerned this object could be huge in some instances. Any
Image retrieval in Servlet and JSP
Image retrieval in Servlet and JSP  Sir, How should i give dynamic paths to image in JSP. EX : `<img src="C:\Users\Public\Pictures\Sample Pictures\-------.jpg" alt="" name="image5" width="980" height="320" id="" />
Advertisements
Image retrieval from mysql - JSP-Servlet
Image retrieval from mysql  Hai friends, I used the following code to insert image into mysql db. Db data type is blob. Database connection codings are in different file which is to be included
JSP Out Object
JSP Out Object  JSP Out Object?   out object denotes... of the object out is jsp.JspWriter. The out object "Javax.servlet.jsp.JspWriter". Methods of out Object:ADS_TO_REPLACE_1 clear() clearBuffer() flush() isAutoFlush
JSP Application Object
JSP Application Object  JSP Application Object?   Application Object is used to share the data with all application pages. Thus, all users.... The Application object is accessed by any JSP present in the application. The class
JSP Response Object
JSP Response Object  JSP response Object ?   The response object denotes the HTTP Response data. The result or the information of a request is denoted with this object. The response object handles the output
Dynamic retrieval od data from database and display it in the table at jsp
Dynamic retrieval od data from database and display it in the table at jsp ... the details of 20 members in a table format at jsp page by dynamically retrieving...; Here is a jsp code that retrieves the data from the database and display
JSP Session Object
JSP Session Object  JSP Session Object?   Session Object... or the interface name of the object session is http.HttpSession. The object session is written as: Javax.servlet.http.httpsession. The Session Object provides
Page object - JSP-Servlet
of PAGE object of implicit JSP object. If this is possible explain me about it's methods. I did not find any methods or explanation of this object. Pls help me....  Hi friend, Implicit Objects in JSP are objects
JSP Request Object
JSP Request Object  JSP Request Object ?   request object in JSP is used to get the values that the client passes to the web server during an HTTP request. The request object is used to take the value from the client?s
How to store data entered in JSP page by a user in XML file & later retrieval of data using id at other page
How to store data entered in JSP page by a user in XML file & later retrieval of data using id at other page  I have made a form in JSP having emp id... in another jsp page using retrieve submit button.Please tell step by step instructions
Pass a dom object from jsp to servlet
Pass a dom object from jsp to servlet  I am creating a dom object in my jsp page. now i want to pass that object in a servlet through calling servlet in jsp. can anyone help me
JSP implicit object "application"
JSP IMPLICIT OBJECT application In this section, we will discuss about JSP... in an application. It means the "application" object is accessed by any JSP... of Application object is used to write a text string to the JSP Container?s default log
Request Object In JSP
Request Object In JSP       This section illustrates more about the JSP implicit object called... to the server, is received by the HTTP request object of the JSP. To access
JSP Implicit object "session"
JSP IMPLICIT  OBJECT "SESSION"In this Section , we will discuss about JSP implicit object "session" with an example. Session Object... of object as string's value and you can get this value in other JSP page
get a session object - JSP-Servlet
get a session object  how to do in a table when i click on a radio button i should get the id value which is in the same row and store it in the session this is in jsp when in the servlet if i call a get session i have to get
Bussiness Object API - JSP-Servlet
Bussiness Object API  I m feteching the reports from CMS server and displaying the report on web page . the problem is that displaying a report takes... = (IReportSourceFactory)enterpriseSession.getService("PSReportFactory"); Object
How to use an object properties in jsp page
How to use an object properties in jsp page  I have a arraylist of objects 'User' populated using struts 2 action class while loading that jsp page. In that JSP I have included another jsp using following tag: Here instead
How to get jSon object in servlet from jsp - JSP-Servlet
How to get jSon object in servlet from jsp  How to get jSon object in servlet from jsp? In jsp page i have written: var sel... object in servlet???  Hi Friend, Please visit the following link
Read MultipartRequest object twice. - JSP-Servlet
Read MultipartRequest object twice.  Hi, Thanks for your reply for "How to revert back ServletInputStream object after reading once." Q. Now I am facing problem for ServletInputStream object. Can we read stream twice
Retrieval data from database against timer
Retrieval data from database against timer  Please send me a sample timer code which retrieve data from the database against timer in JSP
JSP implicit object out
JSP implicit object out In this Section, we will discuss about implicit object out & it's methods. Out object denotes the Output stream...;jsp.JspWriter". This object is instantiated implicitly from JSP Writer class
Retrieval of Dropdown list
Retrieval of Dropdown list  Hi frnds... Am having problem with the below code... I have retrieved data from the mysql database into dropdownlist ... for eg, let A1,A2,A3,A4 be the values in dropdown.. if i click A1
JSP implicit object "request"
JSP implicit object "request" In this section, we will discuss about the implicit object "request" and its uses with an example...; <head><title>Request Object In JSP.</title></head>
Track user's session using 'session' object in JSP
Track user's session using 'session' object in JSP This section is about tracking user identity across different JSP pages using 'session... with the help of session API. JSP provides an implicit object called session which
JSP implicit object "pagecontext"
JSP IMPLICIT OBJECT  pagecontext A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several... and pageContext are implicit JSP Objects. The page object represents
JSP implicit object "response"
JSP implicit object "response" In this section, we will discuss about JSP implicit object "response" with an example. Using 'response' object , reply is sent back to the browser. It is an implicit object
request object - JSP-Servlet
How to revert back ServletInputStream object after reading once. - JSP-Servlet
. My Q is how can I iterate request object twice? How we can revert back...How to revert back ServletInputStream object after reading once.  Hi All, I am trying to get parameter from request object which is multipart/form
object
object  is it possible to create object in the same class..?.   Yes, you can. class CreateObject { CreateObject(){ System.out.println("I have an object."); } public static void main(String[] args
ModuleNotFoundError: No module named 'weather-forecast-retrieval'
ModuleNotFoundError: No module named 'weather-forecast-retrieval'  Hi...: No module named 'weather-forecast-retrieval' How to remove the ModuleNotFoundError: No module named 'weather-forecast-retrieval' error? Thanks
Request Object In JSP.
Retrieval column details into respective JComboboxs
Retrieval column details into respective JComboboxs   Hello sir, As of now i created program in the Eclipse the GUI window .I had creaated the GUI window & also i had created the table in MSSQL the differet columns
JSON array objects retrieval in javascript
JSON array objects retrieval in javascript   I am fetching some data from database and want to show these values in a combo in javascript but combo box is not populating any value, perhaps i am doing something wrong in json
getAttribute() Method Of The Request Object
for the illustration of the getAttribute() method of the request object in JSP... getAttribute() method of the object in JSP. Here, you will see that how both... getAttribute() Method Of The Request Object
how to generate a bar chart on a JSP PAGE using the arraylist object passed form the servlet.(using jfreechart)
how to generate a bar chart on a JSP PAGE using the arraylist object passed... contains only one object(rollno,name,marks1,marks2,marks3,marks4) from the database.now i have to pass this arraylist object to a jsp page and on that jsp page
getRequestURI() Method Of The Request Object
getRequestURI() Method Of The Request Object... the detailed explanation of the getRequestURI() method of the request object in JSP. This method is used for getting the information of the URI of the current
getAttributeNames() Method Of The Request Object
object in JSP. Here, you will learn why this is used and how it is used in the JSP application. Here, you will see that three files are provided... getAttributeNames() Method Of The Request Object
ArrayList object
ArrayList object  i have am ArrayList object it containg data base records in it, now i want to display this ArrayList object data in my jsp programe, plz help me
jsp
jsp  In any jsp all implicit objects are available directly, in such a case why we need PageContext object again
setAttribute() Method Of The Request Object
the best illustration about the setAttribute() method of the request object in JSP... setAttribute() Method Of The Request Object... is retrieved later either in the current JSP page or the another JSP page by passing
object of object class
object of object class  what do u mean by "object of object class
JSP Plugin
JSP Plugin          Syntax: <jsp: plugin type = "bean |applet" code = "ClassFileName" codeBase = "ClassFileDirectoryName"> The <jsp:plugin>
implect object
implect object  how i implment implect object   Hi Friend, Please visit the following links:ADS_TO_REPLACE_1 http://www.roseindia.net/help/java/o/jsp-implicit-objects.shtml http://www.roseindia.net/jsp
Java Xml -Node retrieval - Java Beginners
= xpath.compile("/or:AddOrder/Order/BuyersID"); Object result = expr.evaluate(doc
jsp - JSP-Servlet
JSP Scope Objects  What is Scope Object in JSP
Changing loacation for file object - JSP-Servlet
JSP
JSP  what are the different scopes an object can have in a jsp page   JSP Scope Variables: Page scope-It makes the data available... the following links: http://www.roseindia.net/jsp/simple-jsp-example
JSP Request URI
the request object that will return the URI of the current JSP page. Understand... JSP Request URI          JSP Request URI is used to return the URI
jsp 18/04/2013
jsp 18/04/2013  how to retrieve collection object in jsp page

Ads