how to retrive
this my servlet page..
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
DataSource ds=null;
Connection con = null;
PreparedStatement smp = null;
ResultSet rs = null;
try {
Context c =new InitialContext();
ds = (DataSource)c.lookup("jdbc/surevac");
con =ds.getConnection();
ArrayList al=null;
ArrayList Product_List =new ArrayList();
String query = "select * from PRODUCT_LIST";
smp = con.prepareStatement(query);
rs = smp.executeQuery(query);
while(rs.next())
{
al = new ArrayList();
al.add(rs.getInt(1));
al.add(rs.getString(2));
System.out.println("al :: "+al);
Product_List.add(al);
}
request.setAttribute("Product_List",Product_List);
String nextJSP = "Administrotar/Product_list.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
dispatcher.forward(request,response);
con.close();
} catch (Exception e) {
System.out.println("......."+e);
}
}
and this is my jsp page..
<%
String bgcolor="";
int count=0;
List viewList = new ArrayList();
Iterator viewItr;
if(request.getAttribute("userList")!=null && request.getAttribute("userList")!="")
{
List userList = (ArrayList)request.getAttribute("userList");
Iterator itr = userList.iterator();
while(itr.hasNext())
{
if(count%2==0)
{
bgcolor = "#C8E2D1";
}
else
{
bgcolor = "#EAF8EF";
}
viewList = (ArrayList)itr.next();
int id = Integer.parseInt(viewList.get(0).toString());
viewItr = viewList.iterator();
%>
<tr style="background-color:<%=bgcolor%>;">
<%
while(viewItr.hasNext())
{
%>
<td><%=viewItr.next()%></td>
<%
}
count++;
%>
<td><input type="button" name="edit" value="Edit" style="background-color:#49743D;
font-weight:bold;color:#ffffff;"
onclick="editRecord(<%=id%>);" >
</td>
<td>
<input type="button" name="delete"
style="background-color:#ff0000;
font-weight:bold;;color:#ffffff;"
value="Delete"
onclick="deleteRecord(<%=id%>);"></td>
</tr>
<%
}
}
if(count==0)
{
%>
<tr><td colspan="9" align="center"> </td></tr>
<tr><td colspan="9" align="center">No Record Avaliable</td></tr>
<%
}
%>
it's not working..ple anybody can correct is code.....
View Answers
Related Tutorials/Questions & Answers:
how to retrivehow to retrive this my servlet page..
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response
how to retrive data grom database in jsp pages.how to
retrive data grom database in jsp pages. sir,
i have problem to retrieve data from table of the database on the html web pages , so would yuo please help me about this.
please post me solution on my email id
Advertisements
how to retrive other details with an image - Swing AWThow to
retrive other details with an image hello
I m trying to
retrive an image as well as some other values from database..
but only image.....
followingis my code..plz advice me
how to get both values as well as image at a same
how to insert data into database using jsp & retrivehow to insert data into database using jsp & retrive Hello,
I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
Retrive ValuesRetrive Values I want to
retrive the values between the td by the id using the javascript.So please help me...
html form like this
<TABLE...;
</TABLE>
And I want to
retrive Cell 1,Cell 2,Cell 3
retrive mails - Java Beginnersretrive mails hi
how to
retrive mails using mysql in java not using pop3 or imap
directly from database
i am using dbfile system in james server.header should be store in database and message in file system
thanks
bala
retrive values - JSP-Servletretrive values
how to
retrive multiple values from html to jsp Hi Friend,
Try the following code:
1)calljsp.html:
Enter Name:
Enter Address:
Gender:MF
Qualification:
Btech
MBA
MCA
MSC
image retrive into DataBase - JDBCimage
retrive into DataBase Dear Deepak Sir,
How to
retrive the image into DataBase.
Thanks & Regards,
VijayaBabu.M Hi... shows you
how to retrieve image from database using a servlet and then show
File Upload and Retrive filesFile Upload and
Retrive files Can any body help me am getting an error in uploading file. into mysql database....
thank's in advance
retrive data from database?retrive data from database? hellow
i have a database sheet name..... now i want
retrive sn,roll no and name and textbox
like....,rllno,and name
retrive store and retrive image from the databasestore and
retrive image from the database please provide me with the code and the explanation of what each line does for the below query.
-
how to store and retreive images from sql database using sql commands
-
how to store
retrive data from database retrive data from database hi..
i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
To retrive data from database - StrutsTo
retrive data from database
How to get values ,when i select a select box in jsp and has to get values in textbox automatically from database?
eg:I have three tables in database,and in jsp page if i select courseid in select
jsp retrive image - JSP-Interview Questionsjsp
retrive image
How to Display Images in JSP retrieved from MYSQL database?
plz help me.. Hi Friend,
Please visit the following link:
http://www.roseindia.net/jsp/retrieve-image.shtml
Thanks
retrive data from oracle to jspretrive data from oracle to jsp i am a beginer in jsp so please help me out.....
in file create project i am entering proj details such as id name...;
}
}
in SearchProjDAO i have to call servlet also
how can i do this
i have
GWT -- retrive the data from DatabaseGWT --
retrive the data from Database the user can create an event. In the create page, we have three buttons. Save as draft, preview and save and post buttons. Once the user entered all the datas and if he clicks the Preview
store and retrive image from database - JDBCstore and
retrive image from database
how to store and
retrive an image in database using java? Hi friend,
Code for store image in database using Java.
import java.sql.*;
import java.io.*;
public class
insert and retrive data and time - SQLinsert and
retrive data and time hello everybody .
Is there any method in java so that we can insert current system time and then it can be retrieve that date and time from database ?
..........................
to retrive e mails as per user name - Java Beginnersto
retrive e mails as per user name hi friends,
how to
retrive e mails as per user "user name "
for ex:
class Mail{
private String subject... to
retrive all mails for user "userName"
//and return a set of mail objects
Request URl using Retrive data from dtabaseRequest URl using
Retrive data from dtabase Using With GWT
the user can create an event. In the create page, we have three buttons. Save as draft, preview and save and post buttons. Once the user entered all the datas and if he
java [ cannot retrive date from sql ] why??java [ cannot
retrive date from sql ] why??
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException... cannot I
retrive data from bd even if I put correct data in it
if( rs.next
correct the sql error and retrive data....plezcorrect the sql error and
retrive data....plez i am getting a SQL Error while retriving data from access to jframe called "datatype mismatch in criteria expression" plez do help me and studentId's datatye is number
Retrive values from an arraylist and display in a jsp?Retrive values from an arraylist and display in a jsp? Hi,
I need help in jsp to display values of an ArrayList in jsp.
There is a java file containing a method which is returning an
ArrayList.
I want to display the records
retrive data from database using jsp in struts? retrive data from database using jsp in struts? *search.jsp*
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
Retrive values from an arraylist and display in a jsp?Retrive values from an arraylist and display in a jsp? Hi,
I need help in jsp to display values of an ArrayList in jsp.
There is a java file containing a method which is returning an
ArrayList.
I want to display the records
retrive article from sql databse and show using phpretrive article from sql databse and show using php hello sir
i have sql database which i store articles.i want to show these article on web page using php. my field are image,title,summary,content id. plz provide me
url parameter using retrive data from database in jspurl parameter using
retrive data from database in jsp the user can create an event. In the create page, we have three buttons. Save as draft, preview and save and post buttons. Once the user entered all the datas and if he
url parameter using retrive data from database in jspurl parameter using
retrive data from database in jsp The user can create an event. In the create page, we have three buttons. Save as draft, preview and save and post buttons. Once the user entered all the datas and if he