how to retrive

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">&nbsp;</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 retrive
how 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 database information using servlet and disply in table format in browser
How to retrive database information using servlet and disply in table format in browser  Hi, any one send code how to retrive the data base information in table format in web browser
how to display or retrive an image in jsp whose path is stored in oracle database
how to display or retrive an image in jsp whose path is stored in oracle database  how to display or retrive an image in jsp whose path is stored in oracle database and the image is stored in my pictures folder
how to retrive other details with an image - Swing AWT
how 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 retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  ... names are username,password,email,firstname,lastname. But i want to retrive 3 rd record based on username and password. I dont know how to retrive in php with mysql
how retrive data from google analystics dashbord on the client machine
how retrive data from google analystics dashbord on the client machine   sir i am digvijay subj: retrive data from google analystics dashbord respected sir, According above subject i request you , i want retrive data from
how can retrive value from combo box in servlet?
how can retrive value from combo box in servlet?  i have a jsp page with combobox. And i want to get value from combox to servlet
how to insert data into database using jsp & retrive
how 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
How to retrive an inmage from database and displaying it in imgae box - Swing AWT
How to retrive an inmage from database and displaying it in imgae box ...? I want to retrive an image from database and to display it in a small imagebox or pane in a JFrame.. is this possible? can you plz help tell me how we can do
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  when am using mysqlfetcharray() that display the following error. the code look like this.. <?php $con = mysql_connect("localhost","root
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
Retrive Values
Retrive 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 Beginners
retrive 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-Servlet
retrive 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
how to convert image into bytes and also retrive the image from that bytes - Java Beginners
how to convert image into bytes and also retrive the image from that bytes  how to convert image into bytes and also retrive the image from that bytes?  Hi friend, Code to help in solving the problem : import
image retrive into DataBase - JDBC
image 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 files
File 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 database
store 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
retrive image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream
To retrive data from database - Struts
To 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
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
jsp retrive image - JSP-Interview Questions
jsp 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 jsp
retrive 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 Database
GWT -- 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
after entering details in reg page,n enter the submit button,how can v store the data in db, n hw can v retrive the data frm db in jsp
the submit button,how can v store the data in db, n hw can v retrive the data frm...after entering details in reg page,n enter the submit button,how can v store the data in db, n hw can v retrive the data frm db in jsp  i ve creted
store and retrive image from database - JDBC
store 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 - SQL
insert 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 Beginners
to 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
insert and retrive image from sql server database in jsp
insert and retrive image from sql server database in jsp  what is the code to insert and retrive an image from sql server database in jsp
Request URl using Retrive data from dtabase
Request 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
Retrive the data from the table in data base using jdbc
Retrive the data from the table in data base using jdbc  Retrive the data from the table in data base using jdbc   JDBC Tutorials
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....plez
correct 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 the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
retrive mails from user using java code - Java Beginners
retrive mails from user using java code   how to retrive mails as user "username"??? using java for ex: class Mail{ private String subject... to retrive all mails for user "userName" //and return a set of mail objects
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 record from the text field and insert into to database
retrive record from the text field and insert into to database  the following code is inserting values in the my sql database but i want to insert the data into oracle database , i want what changes i have to make
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 databse to a text field - Java Server Faces Questions
Retrive data from databse to a text field  Hi, Can you give me a source code to rertrve data from Mysql databse to a text field using JSF.....by selecting option from a dropdown option
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
By dropdownlist retrive data from database and show in textbox in jsp.
By dropdownlist retrive data from database and show in textbox in jsp.  Hello Sir, I am doing project in jsp.I have to retrive data from database, when I select value from dropdownlist, and that data I want to show in textbox
retrive the result of a serach string from other sites - JSP-Servlet
retrive the result of a serach string from other sites  Sir, suppose i have create my own websites, and i want to search an item in my sites and as well as from other search sites and i want to show all the search result in my
retrive article from sql databse and show using php
retrive 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
retrive data from data base and print it in every page until logout
retrive data from data base and print it in every page until logout  suppose that a user login your website through user name & password. now after completion of login he goto home page.inside home page i want to print
url parameter using retrive data from database in jsp
url 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 jsp
url 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

Ads