The Artima Developer Community
Sponsored Link

Java Answers Forum
Need Help in Jsp

4 replies on 1 page. Most recent reply: Nov 26, 2003 1:11 PM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Madan

Posts: 1
Nickname: madan
Registered: Nov, 2003

Need Help in Jsp Posted: Nov 22, 2003 1:00 AM
Reply to this message Reply
Advertisement
ca some one give me an idea, or a code snippet for the following.

I have a Jsp page, where I want to display the information in a tabular form retrieved from the Database. But it has to display only few records at a time, by clicking the next, the next few records should be displayed.it should go like this.one u move next previous should also work.

Thank u.

Madan


Birendar S Waldiya

Posts: 21
Nickname: ebiren
Registered: Nov, 2003

Re: Need Help in Jsp Posted: Nov 23, 2003 2:14 AM
Reply to this message Reply
I too have to dispalay the records of one thousand employees in the slab of say 20 each time ...
Though i have never done this before i think this can be done as follow...
get all of the records at a time store then in a vector or hastable..
and then retrieve them using logic for every slab we wanna to dispaly..
please if any body has done please suggest all the alternative way this can be done..
thanks ...

Birendar S Waldiya

Posts: 21
Nickname: ebiren
Registered: Nov, 2003

Re: Need Help in Jsp Posted: Nov 24, 2003 2:21 AM
Reply to this message Reply
Yaa got idea that , this is possible by using result set interfaces method absolute(int ) method that will place the cursor in that particular index ..

Birendar S Waldiya

Posts: 21
Nickname: ebiren
Registered: Nov, 2003

Re: Need Help in Jsp Posted: Nov 24, 2003 9:50 PM
Reply to this message Reply
Hi,
Sending some code for reference ...just to give you the idea this is how i have implemented it Using ResultSet's absolute method ..(scrollable result set)..

But now my question to forum is: does this page when called again and again hit data base all time ?? or are the result once fetch are stored in some temperory memory in database..

 try{
		  stmt= conOracle.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
		  rs1=stmt.executeQuery(selectQuery.toString());
	 int k =0;
		
	
	 if(!rs1.isLast()){
		 rs1.absolute(recorder);  //this is where i make the cursor to place itself to fetch next records..
	 }else{
		 recorder = 1;
		 pagee = 1;
	 }
		
	
	 while(rs1.next()){ %>
	 <tr>
	  <td nowrap class="TrtblS_ra"><a href="./mis_project_det.jsp?proj_no=<%=rs1.getString("PROJECT_NUMBER")%>"><%=rs1.getString("PROJECT_NUMBER")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("Project_Description")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("BRANCH")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("DELIVERY_CENTER_NAME")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("PROJECT_LOCATION")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("PROJECT_TYPE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("CLIENT_GEO")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("CUSTOMER_NAME")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("GROUP_LARGE_CUSTOMER")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("EMPLOYEE_NUMBER")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("EMPLOYEE_NAME")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("CC_NONCC_BA")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("DEPARTMENT")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("MAPP_DESIGNATION_CODE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("ALLOCATION_START_DATE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("ALLOCATION_END_DATE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("PERSON_TYPE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("TEAM_ROLE")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("CATEGORY")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("BASE_DC_NAME")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("BASE_BRANCH_NAME")%></td>
	  <td nowrap class="TrtblS_la"><%=rs1.getString("TEAM_ROLE")%></td>
	  <td nowrap class="TrtblC_la"><%=rs1.getString("EMP_LOCATION")%></td>
	  </tr>
	  <% k++ ;
	
	 if(k%50==0){ // displays records in set of 50 at a time
			recorder =recorder+50;
			pagee ++;
			rs1.absolute(recorder);
			break;
			}
			
		}
 
 
		 if(k==0){%>
		  <tr nowrap colspan="12">
			<td nowrap class="TrtblS_la" colspan="12">No Data Found </td>
		 </tr>
		 <% }%>
 

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Need Help in Jsp Posted: Nov 26, 2003 1:11 PM
Reply to this message Reply
Suggestion:
put the data retrieved from the sql query in a List of objects, one object for eac row of data, set the List as a session objection, and then display only the rows from the session object you want.

Flat View: This topic has 4 replies on 1 page
Topic: Problems Previous Topic   Next Topic Topic: ABOUT J2EE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use