how to retrive

Ads
 

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

Ads









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 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
Advertisements
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 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 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 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 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
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
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
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
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
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 & 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
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
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
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
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
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 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 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 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
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 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

Ads