Row column

Discussion in 'JSP' started by kunju, Mar 26, 2006.

  1. kunju

    kunju New Member

    Joined:
    Mar 26, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    I am doing a matrimonial project in java server pages. So what i want is searching method should be displayed 4 rows and 4 coumns.Rremaining items should be accessed through
    by clicking next to see the next page. Could someone please help me?urgent.please.

    bye
    kunju
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    Its simple. Just fetch n+4 no of results starting from n where n is the page number passed as the paramter to the page via the url or form. n defaulting to 0 will be the first page.
     
  3. kunju

    kunju New Member

    Joined:
    Mar 26, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Reply

    Hello
    First of all let me say thanxfor reply.Could you pls give me a simple example showing
    the data from the database in matrix model.It will bevery helpful me to understand.
    Thanx,
    bye
    kunju
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    What database you are using.
     
  5. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    4 Rows and 4 Columns can be displayed using tables I guess.
     
  6. kunju

    kunju New Member

    Joined:
    Mar 26, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    I am using MSAccess.Can you pls give me a simple
    example too?its urgent.
     
  7. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    I have never really used JSP, and its been a long time since I worked on MS Access. But I can surely help you out with the logic.

    Rtrieve 16 rows from the table, by using something like this SELECT TOP 16 * FROM table

    Loop through the record set, and print 4 <tr>s containing 4<td>s each, like this.

    Code:
     print "<table>";
      
      i=0
      while(!ors.EOF)
      {
        if(i==0)
          print "<tr>";
        print "<td>"+data+"</td>";
     i++;
        if(i==4)
       {
       print "</tr>";
       i=0;
       }
      }
      
      print "</table>";
    For pagination, i.e. showing in pages, you'll have to pass the current page no. in the query string, which can the be used to retrive records and show in pages something like this.

    cur_page=page_no_frm_q_string;

    all the work is in the query that you make. I guess you have to set ors.PageSize and then retrive the current page.

    Guess this should be informative http://support.microsoft.com/?kbid=209126 .
     
    Last edited: Mar 27, 2006

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice