• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

paging concept

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi


in my forum ,employee names will be stored in vector;i want to display those names as paging;per page i want to display 5 records;i want to give next ,previous buttons;these values r not coming from database;
how to achieve simple paging in jsp;i searched the forum i didnt get good one;
[ June 22, 2004: Message edited by: kesava chaitanya ]
 
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
store vector into session, then each time get the value from sesion and display it..
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kesava

If i am not wrong u want something like google shows after results.

It is quite a simple thing in Jsp

Have u hearsd abt Display taglib just download that from net

And u can use the following code for displaying ur records in pages

<display:table name= ur vector name which is comingin form or Request class="Data" id="row" requestURI="the class u r coming from " pagesize="5">
<display:column property="property of the object in list" title="Any heading for the column" />
</display:table>

try this out u have to download the tld for display that u will get on Sourcrforge.net or opensymphony.com

any futher help u can post here agian

Best Regards
Pankaj
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
take a look at the JSTL c:forEach tag which is the standardised way to do paging.
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pankaj Narang:
Hi Kesava

If i am not wrong u want something like google shows after results.

It is quite a simple thing in Jsp

Have u hearsd abt Display taglib just download that from net

And u can use the following code for displaying ur records in pages

<display:table name= ur vector name which is comingin form or Request class="Data" id="row" requestURI="the class u r coming from " pagesize="5">
<display:column property="property of the object in list" title="Any heading for the column" />
</display:table>

try this out u have to download the tld for display that u will get on Sourcrforge.net or opensymphony.com

any futher help u can post here agian

Best Regards
Pankaj




if i add some names to my vector; i want to display those names;
i have used display tag lib like this ,but nothing can be found message is coming;
<%@ include file="init.jsp" %>

<%@ page import="java.util.*"%>
<%
Vector player = new Vector();
player.add("Sachin");
player.add("Ganguly");
player.add("Ramehs");
player.add("Sehwag");
player.add("Yuvraj");
player.add("Kaif");
player.add("Dravid");
%>
<display:table name="player" pagesize="10">
<display:column property="name" />
</display:table>
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually i downloaded the zip and able to run the war ;but i am not able to understand how to apply displaytag lib to my code ;is it necessary write bean file;
 
Krishna Srinivasan
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this very simple �..
File.jsp
========
<html>
<%
java.util.ArrayList a = new java.util.ArrayList();
for(int i = 0;i < 45;i++){
a.add(String.valueOf(i));
}
session.setAttribute("data",a);
%>

<jsp:forward page="another.jsp?status=0"/>

</html>
Another.jsp
============
<html>
<%
String status = request.getParameter("status");
int intVar = Integer.parseInt(status);
java.util.ArrayList al = (java.util.ArrayList)session.getAttribute("data");
%>
<form name="form1">
<table>
<%
for(int i = intVar*10;i<intVar*10+10;i++){
%>
<tr>
<td>
<%=al.get(i)%>
</td>
</tr>
<%
}
%>
</table>
<input type="button" value="next" >
<input type="text" value="<%=status%>" name="val">
</form>
<script>
function next(){
cp =parseInt(document.form1.val.value);
cp++;
window.location="another.jsp?status="+cp;
}

</script>
</html>
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic