How to retrieve records from a database and display it in a jsp page.Help!!

Hello everyone ! im very new to this forum.Please help me to solve my problem
First i ll explain what is my requirement or needed.
Actually in my web page i have text box to enter start date and end date
and one list box to select the month .If user select or enter the dates in text box
accordingly the data from ms access database has to display in a jsp page.
Im using jsp and beans.
I tried returning ResultSet from bean but i get nothing display in my web page
instead it goes to error page (ErrorPage.jsp) which i handle in the jsp.
I tried many things but nothing work out please help me to attain a perfect
solution. I tried with my bean individually to check whether the result set has
values but i got NullPointerException . But the values which i passed or
available in the database.
I dint get any reply for my last post please reply atleast to this.
i get the date in the jsp page is by this way
int Year=Integer.parseInt(request.getParameter("year"));
int Month=Integer.parseInt(request.getParameter("month"));
int Day=Integer.parseInt(request.getParameter("day"));
String startdate=Day+"/"+Month+"/"+Year;
int Year1=Integer.parseInt(request.getParameter("year1"));
int Month1=Integer.parseInt(request.getParameter("month1"));
int Day1=Integer.parseInt(request.getParameter("day1"));
String enddate=Day1+"/"+Month1+"/"+Year1;But this to check my bean whether it return any result!
public void databaseConnection(String MTName,String startDate,String endDate)
try
         java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
         java.util.Date fromDate=dateFormat.parse(startDate);
        java.util.Date tillDate=dateFormat.parse(endDate);          
        java.sql.Date sqlFromDate=new java.sql.Date(fromDate.getTime());
        java.sql.Date sqlTillDate=new java.sql.Date(tillDate.getTime());
          String query1="select MTName,Date,MTLineCount from Main where MTName='"+MTName+"'  and Date between '"+sqlFromDate+"' and '"+sqlTillDate+"' " ;
        System.out.println(query1);
          Class.forName(driver);
         DriverManager.getConnection(url);
         preparedStatement=connection.prepareStatement(query1);
         preparedStatement.setString(1,"MTName");
          preparedStatement.setDate(2,sqlFromDate);
          preparedStatement.setDate(3,sqlTillDate);
          resultSet=preparedStatement.executeQuery();           
           while(resultSet.next())
                    System.out.println(resultSet.getString(1));
                    System.out.println(resultSet.getDate(2));
                    System.out.println(resultSet.getInt(3));
        catch (Exception e)
         e.printStackTrace();
I Passed value from my main method is like thisl
databaseConnection("prasu","1/12/2005","31/12/2005");Please provide solutions or provide some sample codes!
Help!
Thanks in advance for replies

Thanks for ur reply Mr.Rajasekhar
I tried as u said,
i tried without converting to sql date ,but still i din't get any results
java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
         java.util.Date fromDate=dateFormat.parse(startDate);
        java.util.Date tillDate=dateFormat.parse(endDate);          
          String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
        System.out.println(query1);
//From main method
databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
---------- java ----------
select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
java.lang.NullPointerException
null
null
java.lang.NullPointerException
Output completed (4 sec consumed) - Normal TerminationThanks
Prasanna.B

Similar Messages

  • Help in retrieveing Blob from Oracle db and display it on a web page

    I am using Sun Studio creator2 and this is what I want to achieve:
    When I click on "Load" button, the image is displayed on the web page(the application is a web application)
    I have dropped the "image" object from the pallette
    Having the database image displayed in the image field, when I enter the image ?Id? and click on the ?Load? button.
    Here is my piece of code:
    public String loadButton_action() {
    HttpServletRequest request = null;
    HttpServletResponse response = null;
    String connectionURL = "jdbc:oracle:thin:@//localhost:1521/cdecentre1";;
    /*declare a resultSet that works as a table resulted by execute a specified
    sql query. */
    ResultSet rs = null;
    // Declare statement.
    PreparedStatement psmnt = null;
    // declare InputStream object to store binary stream of given image.
    InputStream sImage;
    Connection connection = null;
    String driverName = "oracle.jdbc.driver.OracleDriver";
    String dbName = "cdecentre1";
    String userName = "christian";
    String password = "cc";
    String theid = (String)idField.getValue(); //reading the image id
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    connection = DriverManager.getConnection(connectionURL, userName, password);
    /* prepareStatement() is used for create statement object that is
    used for sending sql statements to the specified database. */
    psmnt = connection.prepareStatement("SELECT image FROM CHRISTIAN.PICTURES WHERE id = ?");
    psmnt.setString(1, theid);
    rs = psmnt.executeQuery();
    if(rs.next()) {
    byte[] bytearray = new byte[1048576];
    int size=0;
    sImage = rs.getBinaryStream(1);
    //response.reset();
    response.setContentType("image/jpeg");
    while((size=sImage.read(bytearray))!= -1 ){
    response.getOutputStream().write(bytearray,0,size);
    rs.close();
    psmnt.close();
    connection.close(); } }
    } catch(Exception ex){
    System.out.println("error :"+ex);
    return null; }
    At the moment, when I click on the ?Load? button, the image is not present in the image field.
    I am only obtaining a message inside the message component.
    What should I do to have the image displayed in on the web page?
    Your help will be highly appreciated.

    A comprehensive dissertation from Javaworld: http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets.html
    Published 05/05/2000, ergo Java 1.0/1 era... still a valid explanation of the problem and the fundamental solution, but take the code (esp ImageIO) from here
    http://blog.codebeach.com/2008/02/creating-images-in-java-servlet.html
       1. package com.codebeach.servlet; 
       2.  
       3. import java.io.*; 
       4. import javax.servlet.*; 
       5. import javax.servlet.http.*; 
       6. import java.awt.*; 
       7. import java.awt.image.*; 
       8. import javax.imageio.*; 
       9.  
      10. public class ImageServlet extends HttpServlet 
      11. { 
      12.     public void doGet(HttpServletRequest req, HttpServletResponse res) 
      13.     { 
      14.         //Set the mime type of the image 
      15.         res.setContentType("image/jpeg"); 
      16.  
      17.         try 
      18.         { 
      19.             Create an image 200 x 200 
      20.             BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); 
      21.  
      22.             //Draw an oval 
      23.             Graphics g = bufferedImage.getGraphics(); 
      24.             g.setColor(Color.blue); 
      25.             g.fillOval(0, 0, 199,199); 
      26.  
      27.             Free graphic resources 
      28.             g.dispose(); 
      29.  
      30.             //Write the image as a jpg 
      31.             ImageIO.write(bufferedImage, "jpg", res.getOutputStream()); 
                        ////////////// NICE !!!! //////////////
      32.         } 
      33.         catch (IOException ioe) 
      34.         { 
      35.            e.printStackTrace();
      36.         } 
      37.     } 
      38. }  Edited by: corlettk on 19/01/2009 23:22 ~~ {color:#FF0000}Never{color} eat an exception!

  • Retrieving data from oracle database and displaying using servlets

    //DataRetrieving.class file
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DataRetrieving extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws
    ServletException, IOException{ 
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("A program for connecting oracle database");
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL", "scott","tiger");
    Statement stmt = con.createStatement();
    ResultSet r = stmt.executeQuery ("SELECT ename,job,sal,comm,deptno FROM emp");
    while ( r.next() )
         String bar = r.getString("ename");
         String bar1 = r.getString("job");
         float bar2 = r.getInt("sal");
         float bar3 = r.getInt("comm");
         int bar4 = r.getInt("deptno");
         //out.println(r.getString(0)+" "+r.getString("ename"));
         out.println("hi");
         out.println(bar1);
    r.close();
    stmt.close();
    con.close();
    catch (Exception e)
    out.println("ERROR : " + e);
    //web.xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd"> -->
    <web-app>
    <servlet>
    <servlet-name>Hello</servlet-name>
    <servlet-class>DataRetrieving</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/DataRetrieval</url-pattern>
    </servlet-mapping>
    </web-app>
    while running the servlet , i am unable to retrieve the data
    The error message i am getting is
    A program for connecting oracle database
    ERROR : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    after running the servlet.
    what could be the problem?

    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class myserv extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    res.setContentType("text/html");
    PrintWriter pw=res.getwriter();
    pw.println("Connecting data base");
         try
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=Drivermanager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
         Stamtenet st=con.createStament();
         Resultset rs=con.executeQurey("select * from emp");
         while(rs.next())
         rs.getInt("empno")+" "+rs.getDouble("sal"));
         }catch(Exception e)
    }

  • How to extract image from oracle database and display at html page

    Could you help me how to make the image to display. i manage to extract the data but the data is in Blob so i need to convert it so make it display at html page.

    Thanks for ur reply Mr.Rajasekhar
    I tried as u said,
    i tried without converting to sql date ,but still i din't get any results
    java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
              String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
            System.out.println(query1);
    //From main method
    databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
    ---------- java ----------
    select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
    java.lang.NullPointerException
    null
    null
    java.lang.NullPointerException
    Output completed (4 sec consumed) - Normal TerminationThanks
    Prasanna.B

  • How to fetch records from the database into a combo box?

    Hi:
    I&acute;m really new with ABLBPM and I&acute;m trying to fetch records from the database to display them into a combo box as valid values for a presentation but I&acute;m using a dynamic method with this code:
    <em>for each row in SELECT campo1, campo2 from TABLE</em>
    <em>do</em>
    <em>solicitudes[] = [row.campo1, row.campo2]</em>
    <em>end</em>
    <em>return solicitudes
    </em>And the debugger says that SQL instructions can be used only in fuctions and procedures that are executed on the server.
    Do you know another way to do it?
    P.D. Sorry for my terrible english
    Greetings

    Hi Steve,
    Thank you, your idea is perfect, but when I try to run the screenflow where the combo should be filled I get this error:
    fuego.lang.ComponentExecutionException: No se ha podido ejecutar correctamente la tarea.
    Motivo: 'java.lang.NullPointerException'.
         at fuego.web.execution.InteractiveExecution.setExecutionError(InteractiveExecution.java:307)
         at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:166)
         at fuego.web.execution.impl.WebInteractiveExecution.process(WebInteractiveExecution.java:54)
         at fuego.webdebugger.servlet.DebuggerServlet.redirect(DebuggerServlet.java:136)
         at fuego.webdebugger.servlet.DebuggerServlet.doPost(DebuggerServlet.java:85)
         at fuego.webdebugger.servlet.DebuggerServlet.doGet(DebuggerServlet.java:66)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at fuego.web.execution.servlet.ServletExternalContext.forwardInternal(ServletExternalContext.java:197)
         at fuego.web.execution.servlet.ServletExternalContext.processAction(ServletExternalContext.java:110)
         at fuego.webdebugger.servlet.DebuggerExecution.dispatchComponentExecution(DebuggerExecution.java:64)
         at fuego.web.execution.InteractiveExecution.invokePrepare(InteractiveExecution.java:351)
         at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:192)
         at fuego.web.execution.impl.WebInteractiveExecution.process(WebInteractiveExecution.java:54)
         at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:223)
         at fuego.webdebugger.servlet.DebuggerServlet.doDebug(DebuggerServlet.java:148)
         at fuego.webdebugger.servlet.DebuggerServlet.doPost(DebuggerServlet.java:82)
         at fuego.webdebugger.servlet.DebuggerServlet.doGet(DebuggerServlet.java:66)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    Any ideas??
    Thanks and greetings

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • Read image data from SQL Server database and display it in a JSP web page

    Hi experts,
    I am doing a project in which I have to upload images to the database via JSP/servlets. I am able to do this.
    Now I want users to view and dowload these images which are stored in the database.
    Please help me of how can I read the images from the database and display it on jsp webpage and also can be downloaded by users via jsp pages on client side.
    Please help!

    Hi you may go through the below post to find what could be a better way to do that.
    http://forum.java.sun.com/thread.jspa?threadID=5163829
    REGARDS,
    RaHuL

  • Select records from one database and insert it into another database

    Hi
    I need to write a statement to select records from one database which is on machine 1 and insert these records on a table in another database which is on machine 2. Following is what I did:
    1. I created the following script on machine 2
    sqlplus remedy_intf/test@sptd @load_hrdata.sql
    2. I created the following sql statements in file called load_hrdata.sql:
    rem This script will perform the following steps
    rem 1. Delete previous HR data/table to start w/ clean import tables
    rem 2. Create database link to HR database, and
    rem 3. Create User Data import table taking info from HR
    rem 4. Drop HRP link before exiting
    SET COPYCOMMIT 100
    delete from remedy.remedy_feed;
    commit;
    COPY FROM nav/donnelley@hrp -
    INSERT INTO remedy.remedy_feed -
    (EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR) -
    USING SELECT EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR -
    FROM ps_rrd_intf_medium -
    where empl_status IN ('A', 'L', 'P', 'S', 'X')
    COMMIT;
    EXIT;
    However, whenever I run the statement I keep getting the following error:
    SP2-0498: missing parenthetical column list or USING keyword
    Do you have any suggestions on how I can fix this or what am I doing wrong?
    Thanks
    Ali

    This doesn't seem to relate to Adobe Reader. Please let us know the product you are using so we may redirect you or refer to the list of forums at http://forums.adobe.com/

  • Performance Issue: Retrieving records from Oracle Database

    While retrieving data from Oracle database we are facing performance issues.
    The query is returning 890 records and while displaying it on the jsp page, the page is taking almost 18 minutes for displaying records.
    I have observed that cpu usage is 100% while processing the request.
    Could any one advise what are the methods at DB end or Java end we can think of to avoid such issues.
    Thanks
    R.

    passion_for_java wrote:
    Will it make any difference if I select columns instead of ls.*
    possibly, especially if there's a lot or data being returned.
    Less data over the wire means a faster response,
    You may also want to look at your database, is that outer join really needed? Does it perform? Are your indexes good?
    A bad index (or a missing one) can kill query performance (we've seen performance of queries drop from seconds to hours when indexes got corrupted).
    A missing index can cause full table scans, which of course kill performance if the table is large.

  • How to count records from 2 tables and show in RDLC Report

    hi all,
    its being a one day searching for the solution but No Luck.
     I have two SQL tables tblstudetail and tblfeereceiptdetail.
    i just want to count records from both tables and show in RDLC report.
    I tried SQl Query Like This:
    select a.session, a.course,
    Count(CASE a.ADstatus WHEN 'OK' THEN 1 ELSE 0 END ) AS Admission,
    Count(CASE s .I_receiptstatus WHEN 'OK' THEN 1 ELSE 0 END) AS Feeprint
    from
    tblstudetail a
    FULL join
    tblfeereceiptdetail s on s.studentID = a.studentID
    where a.session = '2015' AND s.Fsession = '2015' AND a.adcat = 'Regular'
    GROUP BY a.session,a.course
    ORDER by a.course
    The result Show the Same Value in Both columns
    Session    Course      Admission       FeeDetail
    2015          B.A. I               275              275
    2015          B.A. II              307             307
    2015         B.A. III             255            255
    2015          B.Sc. I             110             110
    2015           B.Sc. II           105            105
    2015          B.Sc. III            64               64
    Actully I want to Count How many ADMISSION have been Taken(FROM tblstudetail) and How many FEE RECEIPT have been Print (From tblfeereceiptdetail).
    please guide me for this as soon as possible.
    thanks in advance...

    I am counting 'OK' in both the table columns I.e 'ADstatus' in tblstudetail and 'feereceiptstatus' in tblfeereceiptdetail
    please suggest me

  • Retrieving data from an ArrayList and presenting them in a JSP

    Dear Fellow Java Developers:
    I am developing a catalogue site that would give the user the option of viewing items on a JSP page. The thing is, a user may request to view a certain item of which there are several varieties, for example "shirts". There may be 20 different varieties, and the catalogue page would present the 20 different shirts on the page. However, I want to give the user the option of either viewing all the shirts on a single page, or view a certain number at a time, and view the other shirts on a second or third JSP page.
    See the following link as an example:
    http://www.eddiebauer.com/eb/cat_default.asp?nv=2|21472|9&tid=&c=&sc=&cm_cg=&lp=n2f
    I am able to retrieve the data from the database, and present all of them on a JSP, however I am not sure how to implement the functionality so that they can be viewed a certain number at a time. So if I want to present say 12 items on a page and the database resultset brings back 30 items, I should be able to present the first 12 items on page1, the next 12 items on page2, and the remaining 6 items on page3. How would I do this? Below is my scriplet code that I use to retrieve information from the ArrayList that I retrieve from my database and present them in their entirety on a single JSP page:
    <table>
    <tr>
    <%String product=request.getParameter("item");
    ArrayList list=aBean.getCatalogueData(product);
    int j=0, n=2;
    for(Iterator i=list.iterator(); i.hasNext(); j++){
    if(j>n){
    out.print("</tr><tr>");
    j=0;
    Integer id=(Integer)i.next();
    String name=(String)i.next();
    String productURL=(String)i.next();
    out.print("a bunch of html with the above variables embedded inside")
    %>
    </tr>
    </table>
    where aBean is an instace of a JavaBean that retrieves the data from the Database.
    I have two ideas, because each iteration of the for loop represents one row from the database, I was thinking of introducing another int variable k that would be used to count all the iterations in the for loop, thus knowing the exact number. Once we had that value, we would then be able to determine if it was greater than or less than or equal to the maximum number of items we wanted to present on the JSP page( in this case 12). Once we had that value would then pass that value along to the next page and the for loop in each subsequent JSP page would continue from where the previous JSP page left off. The other option, would be to create a new ArrayList for each JSP page, where each JSP page would have an ArrayList that held all the items that it would present and that was it. Which approach is best? And more importantly, how would I implement it?
    Just wondering.
    Thanks in advance to all that reply.
    Sincerely;
    Fayyaz

    -You said to pass two parameters in the request,
    "start", and "count". The initial values for "start"
    would be zero, and the inital value for "count" would
    be the number of rows in the resultSet from the
    database, correct?Correct.
    -I am a little fuzzy about the following block of code
    you gave:
    //Set start and count for next page
    start += count; // If less than count left in array, send the number left to next next page
    count = ((start*3)+(count*3) < list.size()) ? (count) : ((list.size() - (start*3))/3)
    Could you explain the above block of code a little
    further please?Okay, first, I was using the ternary operators (boolean) ? val_if_true : val_if_false;
    This works like an if() else ; statement, where the expression before the ? represents the condition of the if statement, the result of the expression directly after the ? is returned if the condition is true, and the expression after the : is returned if the condition is false. These two statments below, one using the ternary ? : operators, and the other an if/else, do the same thing:
    count = ((start*3)+(count*3) < list.size()) ? (count) : ((list.size() - (start*3))/3);
    if ((start*3)+(count*3) < list.size()) count = count;
    else count = ((list.size() - (start*3))/3);Now, why all the multiplying by 3s? Because you store three values in your list for each product, 1) the product ID, 2) the product Name, and 3) the product URL. So to look at the third item, we need to be looking at the 9th,10th, and 11th values in the list.
    So I want to avoid an ArrayIndexOutOfBounds error from occuring if I try to access the List by an index greater than the size of the list. Since I am working with product numbers, and not the number of items stored in the list, I need to multiply by three, both the start and count, to make sure their sum does not exceed the value stored in the list. I test this with ((start*3)+(count*3) < list.size()) ?. It could have been done like: ((start + count) * 3 < list.size()) ?.
    So if this is true, the next page can begin looking through the list at the correct start position and find the number of items we want to display without overstepping the end of the list. So we can leave count the way it is.
    If this is false, then we want to change count so we will only traverse the number of products that are left in the list. To do this, we subtract where the next page is going to start looking in the list (start*3) from the total size of the list, and devide that by 3, to get the number of products left (which will be less then count. To do this, I used: ((list.size() - (start*3))/3), but I could have used: ((list.size()/3) - start).
    Does this explain it enough? I don't think I used the best math in the original post, and the line might be better written as:
    count = ((size + count)*3 < list.size()) ? (count) : ((list.size()/3) - start);All this math would be unnecessary if you made a ProductBean that stored the three values in it.
    >
    - You have the following code snippet:
    //Get the string to display this same JSP, but with new start and count
    String nextDisplayURL = encodeRedirectURL("thispage.jsp?start=" + start + "&count=" + count + "&item=" + product);
    %>
    <a href="<%=nextDisplayURL%>">Next Page</a>
    How would you do a previous page URL? Also, I need to
    place the "previous", "next" and the different page
    number values at the top of the JSP page, as in the
    following url:
    http://www.eddiebauer.com/eb/cat_default.asp?nv=2|21472
    9&tid=&c=&sc=&cm_cg=&lp=n2f
    How do I do this? I figure this might be a problem
    since I am processing the code in the middle of the
    page, and then I need to have these variables right at
    the top. Any suggestions?One way is to make new variable names, 'nextStart', 'previousStart', 'nextCount', 'previousCount'.
    Calculate these at the top, based on start and count, but leave the ints you use for start and count unchanged. You may want to store the count in the session rather than pass it along, if this is the case. Then you just worry about the start, or page number (start would be (page number - 1) * count. This would be better because the count for the last page will be less than the count on other pages, If we put the count in session we will remember that for previous pages...
    I think with the details I provided in this and previous post, you should be able to write the necessary code.
    >
    Thanks once again for all of your help, I really do
    appreciate the time and effort.
    Take care.
    Sincerely;
    Fayyaz

  • I am using the database connectivity toolkit to retrieve data using a SQL query. The database has 1 million records, I am retrieving 4000 records from the database and the results are taking too long to get, is there any way of speeding it up?

    I am using the "fetch all" vi to do this, but it is retrieving one record at a time, (if you examine the block diagram) How can i retrieve all records in a faster more efficient manner?

    If this isn't faster than your previous method, then I think you found the wrong example. If you have the Database Connectivity Toolkit installed, then go to the LabVIEW Help menu and select "Find Examples". It defaults to searching for tasks, so open the "Communicating with External Applications" and "Databases" and open the Read All Data. The List Column names just gives the correct header to the resulting table and is a fast operation. That's not what you are supposed to be looking at ... it's the DBTools Select All Data subVI that is the important one. If you open it and look at its diagram, you'll see that it uses a completely different set of ADO methods and properties to retrieve all the data.

  • How to retrieve data using logical database and custom select options

    Hi all,
    I have a selection screen which is displayed by logical database PSJ and I have two select options of my own. I need to retrieve data based on both selection screen of logical database and my own select options. How can I do it?
    Thanks in advance.

    Hai Gupta
    Check the following Document & Links
    1. A logical database is in fact
    a program only.
    2. This LDB provides two main things :
    a) a pre-defined selection screen
    which handles all user inputs and validations
    b) pre defined set of data
    based upon the user selection.
    3. So we dont have to worry about from
    which tables to fetch data.
    4. Moreover, this LDB Program,
    handles all user-authorisations
    and is efficient in all respects.
    5. tcode is SLDB
    good info about Logical Database. you can check the link.
    http://www.geekinterview.com/question_details/1506
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Re: How to Create and Use ldb in reports?
    Re: Logical databases
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    Functions for displaying and changing logical databases:
    Call Transaction SE36 or
    Choose ABAP Workbench -> Development -> Programming environ. -> Logical databases
    Interaction between database program and report:
    During program processing, subroutines are performed in the database program and events are executed in the report.
    To read data from a database tables we use logical database.
    A logical database provides read-only access to a group of related tables to an ABAP/4 program.
    advantages:-
    The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
    i)An easy-to-use standard user interface.
    ii)check functions which check that user input is complete,correct,and plausible.
    iii)meaningful data selection.
    iv)central authorization checks for database accesses.
    v)good read access performance while retaining the hierarchical data view determined by the application logic.
    disadvantages:-
    i)If you donot specify a logical database in the program attributes,the GET events never occur.
    ii)There is no ENDGET command,so the code block associated with an event ends with the next event
    statement (such as another GET or an END-OF-SELECTION).
    1. transaction code SLDB.
    2.enter name z<ldb-name>
    3.create
    4.short text
    5.create
    6. name of root node (here Ekko)
    7. enter short text (f6)
    8.node type -> data base table.
    9.create
    10 change logical DB
    riht click on ekko and insert node
    here node name ekpo
    11.create
    12. click on selections
    13. press no Should the changed structure of Z<ldb name> be saved first.
    14.select tables which you want to join.
    15.transfer
    16 now you have to o to coding part.
    17. save
    activate.
    19.click to src code
    double click on first include and activate
    Regards
    Sreeni

  • How to retrieve records from taxonomy table

    Hi,
    I have a main table which has taxonomy field,for ex: category.
    Main table: Products which has ProductName(text),ProductNo(text),Category fields(Lookup[taxnomoy])
    Could anyone please tell me how to retrieve the records and attributes from a taxonomy table.
    Please provide some sample codes.
    Thanks
    Sabari

    Hi Sabari,
    your question is not so clear-  any way find the following example
    if you want to get records based on search criteria( ex: taxonomy values where ProductName = "something "),, follow the below steps;
    1 . build Search Object-  ( I guess you know this step)
    2.  get RecordResultSet Object -
         Example
         //Compose array of the fields to retrieve
         FieldId[] fields = new FieldId[5];
         fields[0] = assign FiledId of Category field ;
         //Create the result definition for the search table
         ResultDefinition rd = new ResultDefinition(productsTableId);
         rd.setSelectFields(fields);
        // Retrive ResultSet
           RetrieveLimitedRecordsCommand recordsCommand = new  
           RetrieveLimitedRecordsCommand(mdmConnection.getConnection());
         recordsCommand.setSession(mdmConnection.getAuthenticatedUserSession().getSession());
         recordsCommand.setResultDefinition(rd);
         recordsCommand.setSearch(search);
         recordsCommand.execute();          
            RecordResultSet  records= recordsCommand.getRecords();
    3 . Now Iterate through resultSet for CategoryRecord lookUp Id
               Record record = records.getRecord( i );
         FieldId[] fieldIds = record.getFields();
                for(int n=0; n<fieldIds.length; n++) {
                   FieldId fieldId = fieldIds[n];
                   FieldProperties fieldProps = records.getRecordMetadata().getField(fieldId);
                   String fieldCode = fieldProps.getCode();
                            MdmValue value = record.getFieldValue(fieldId);                    
                          if(fieldCode.equals("Category")) {                         
                   if (!(value instanceof NullValue)) {
                                  //LookupValue appLookUpValue = (LookupValue) value;
                                  Record[] lookupRecord=record.findLookupRecords(fieldId);
                                  if(lookupRecord!=null && lookupRecord.length>0)
                                                            populate for  a category for every lookup record 
                                       // cat=this.getCategory(lookupRecord[0].getId(),locale);
    Note:- from Main table records  , you will get Category lookup records, you need to look up for every Category lookUp Record; there may be number of Category records for one main table Record;
    if you still face problem , let me know;
    Regards
    Rajasekhar k

  • Search for a record from Access Database, and populate records in Drop Down List, and View It

    Hi,
    I created a PDF form where I have open, next, previous buttons, and I'm able to connect to the access database, and it's working fine. Now, I want to be able to search by last name from the access database, and retrieve the results in a dropdown field, and then once i select the records in the drop downlist, i want to press a button to display the record. I have multiple records with the same last name. Please help, I searched the internet for hours, and can't find something similar. Your help is appreciated, and sample code is appreciated.

    <%
    int count = 0;
    while (rs1.next()){ %>
    <%if (count ==0)
    {%>
    <option value="<%=inputorthodon%>" selected >
    <%=rs1.getString("ortho_name")%></option>
    <%}
    else{%>
    <option value="<%=inputorthodon%>">
    <%=rs1.getString("ortho_name")%></option>
    <%}
    ++count;} %>
    </select>
    U may have to format this a bit. The idea is to use a count variable to put "selected" in only the first OPTION. After that, we don't have to.
    Hope this helps.

Maybe you are looking for

  • Re: [iPlanet-JATO] TiledView - getting Values

    Kostas-- This is because in TiledViewBase.mapRequestParameters(), calling getChild(String name, int tile) before setting the values in the request, will not set the location for the models other that the primary model- effectively we are only setting

  • Lost photos while updating to iOS 5

    First I updated itunes to 10.5, and then I downloaded and installed iOS5 on my iphone 4. Nothing was automatically synced before iOS5 installation, but itunes showed that it was backing up data. After installation, when itunes restored the backup, I

  • Number generation

    hi i have a logic prob  in sap abap. from  serial 279360 to ..... 279360 = AAAA. 279361 = AAAB 279362 = AAAC .... the sequence of alpha code r like AAAA -AAAZ, AABA- AABZ,... AZAA-AZZZ. BAAA- BAAZ,BABA-BABZ,.....BZAA - BZZZ, CAAA- CAAZ,CABA-CABZ,....

  • Printing problems from both wireless iMac & wired XP PC

    I have a fairly new (<1 yr old) AE, connected via Ethernet to an XP PC and wirelessly to an iMac purchased at the same time as the AE. No problems with Internet access on either, but printing to the HP DeskJet D2460 connected to the AE's USB has been

  • Used migration assistant but can't find my stuff

    I recently purchased a new iMac 21.5 inch screen.  I ran the Setup Assistant and then later ran the Migration Assistant.  I migrated my files on the old computer (2006 iMac running Snow Leopard 10.6.8) first using an ethernet cable between the two co