How do I create page just like this one....

Discussions

Web tier: servlets, JSP, Web frameworks: How do I create page just like this one....

  1. How do I create page just like this one.... (7 messages)

    Hi I have to show in JSP x rows out of n rows which retrieved from the sql query I post to Database using JDBC.
    Just like this messages page. How can I get. I'm new to JSP.
    Thanks in advance.
    Soumya.
  2. Hi,

    Take a for loop in scriplet after getting the rows from database.
    ex..
    <%
    /*Data retrieving here....
    /* take rs as resultset ...
    for(int i=0;i<x;++i)
    {
    rs.next();
    out.println(rs.getXXX(1));
    }
    %>

    you can also embed this resultset in html tags...like..
    out.println("<h1>"+rs.getXXX(1)+"</h1>");

    Hope it will help you..

    Thank you
  3. sreenivasa, you're example looks good. If Soumya's goal is to print only a subset of the resultset (i.e., only rows 10 through 20 out of 100 rows), your code would have to be modified. It gets a bit more complicated if you need to be able to move forward and backward through the resultset in groups of 10 records.
  4. Hi,
    If that is the case, you have to take the rows from resultset into vector or hashtable..then you can procedd as i said.

  5. I was looking for the samething, for long time, I need to show for example only the 10th first rows, and have next link in the bottom, and when I click in the next link, I will get the next 10th rows and now two links, one for next and one for previous, coud you please explain to me how to do it, I don't know if someone has done it in a bean class, so in the jsp page we can use only the function that extract the rows from "start" row with a "range", for example:
    public class MyBean {
    ......

    public Vector getThreads(int start, int range) {
    get rs
    ..
    return v;
    }

    please if you have any idea or you already have done it, I will appreciate to hear from you.
    My email : yna54 at hotmail dot com

    Thanks lot
  6. Hi Sreenivasa and Reynolds,
       Is hashable tables and vector is the only solution? Can you tell me how should I proceed? I have to go back and forth on html pages.... you can say just like this forum pages.
    Thanks
    Soumya.
  7. Hi again,
      In my application most of the pages will have this feature with differnt different sql queries and columns and no of columns returned are different for different modules. Can I still use a hash tables and vectors? Can I write a common bean to move onto hash tables/vectors?
    Please help out.
    Thanks.
    Soumya.
  8. Hello

    In java.sql.Resultset , there are some methods
    absolute(),
    next(),
    previous()

    by using using these methos you can do your work.
    vector/hashtable are not necessory.