Login

mvnForum

mvnForum Homepage Welcome Guest
  Search  
  Index  | Recent Threads  | Unanswered Threads  | List Polls  | Public Albums  | Who's Online  | Help


Quick Go »


No member browsing this thread
Thread Status: Active
Total posts in this thread: 5
Post new Thread
Author
Previous Thread This topic has been viewed 1592 times and has 4 replies Next Thread
Male Teja
Stranger



India
Joined: May 5, 2004
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Pagination in jsp

Hi,
I'm very much urgent to have the pagination code using jsp.
Plze help me.
[May 5, 2004 9:50:57 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.msn.com    ravi@yahoo.com [Link] Report threatening or abusive post: please login first  Go to top 
Male DrAnonymous
mvnForum Developer
Member's Avatar


Joined: Apr 7, 2004
Post Count: 56
Status: Offline
Reply to this Post  Reply with Quote 
Re: Pagination in jsp

What is your question? Where are you having a problem? Can you give some details?

Dr. A>
[May 5, 2004 1:38:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: Pagination in jsp

Hi,
I'm very much urgent to have the pagination code using jsp.
Plze help me.

Please have a look at http://www.jsptags.com , this is the pagination used in mvnForum smile
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[May 7, 2004 3:03:55 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Female shashi
Stranger




Joined: Nov 21, 2008
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Re: Pagination in jsp

Hello,

I have a code in jsp in pagination but in it some problem,if any body can solve then please solve it.
its urgent.

Regards
shashi




<%
try
{
int current = 1;
if(request.getParameter("current") != null) {
current = Integer.parseInt(request.getParameter("current"));
}
int skip = 14;

String action = "";
if(request.getParameter("action") != null) {
action = request.getParameter("action");
}
if ( action.equals("next") ) {
current += skip;
}
if ( action.equals("prev") ) {
current -= skip;
}
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<!--
.style1 {
font-size: 14px;
font-weight: bold;
}
.style4 {font-size: 13.5px; font-weight: bold; }
-->
</style>
<link href="aaa.css" rel="stylesheet" type="text/css">
</HEAD>

<BODY>
<H1> </H1>

<FORM NAME="form1" ACTION="details.jsp" METHOD="POST">

<%


st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String coun=(String)session.getAttribute("contry");
System.out.println(coun);
ResultSet resultset =st.executeQuery("select * from table'");

resultset.first();
resultset.last();

int rows = resultset.getRow();
if ( current >= rows ) current = rows-skip;
if ( current < 0 ) current = 0;
resultset.absolute(current);


%>


<table width="849" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="100" align="center" bgcolor="#FFDEB0" class="test"><b> StaffName</b></td>
<td width="150" align="center" bgcolor="#FFDEB0" class="test" ><b>Designation </b></td>
<td width="300" align="center" bgcolor="#FFDEB0" class="style1" ><b> Email</b> </td>
<td width="300" align="center" bgcolor="#FFDEB0" class="style1"><strong>Address </strong></td>
<td width="100" align="center" bgcolor="#FFDEB0" class="style1" ><strong> City</strong></td>
<td width="100" align="center" bgcolor="#FFDEB0" class="style1" ><strong>Country </strong></td>
<td width="100" align="center" bgcolor="#FFDEB0" class="style1" ><strong>Telephone Number</strong></td>
<td width="130" align="center" bgcolor="#FFDEB0" class="style1" ><strong> Mobile number</strong></td>

</tr>
<%

int i=0;
boolean next = false;
do{
i++;
%>
<tr>
<td bgcolor="#FFDEB0" class="test">&nbsp;<% out.println(resultset.getString("staff_name") ); %></td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("designation") ); %></td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("email") ); %></td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("address") ); %></td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("city") ); %> </td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("country") ); %> </td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("contact_no") ); %> </td>
<td bgcolor="#FFDEB0">&nbsp;<% out.println(resultset.getString("mobile") ); %></td>

</tr>
<%
}
while((next=resultset.next()) && i<skip);
%>
</TABLE>
<BR>
<INPUT TYPE="HIDDEN" NAME="current" VALUE="<%=current%>">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="next">
<center>
<%
if(next) {
%>
<INPUT TYPE="BUTTON" VALUE="Next Record" ONCLICK="moveNext()" color="red">
<%
}
if(current > 12) {
%>
<INPUT TYPE="BUTTON" VALUE="Previous Record" ONCLICK="movePrevious()">
<%
}
}
catch(Exception d){//
%>
<center> <h3>"There are no more record Please GO back" </h3> </center>

<%}
%>
<%


%>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
function moveNext()
{
form1.action.value = 'next';
form1.submit()
}
function movePrevious()
{
form1.action.value = 'prev';
form1.submit()
}
// -->
</SCRIPT>
</center>
</BODY>
</HTML>
[Nov 21, 2008 8:54:52 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: Pagination in jsp

Hi shashi, I would suggest you use the pager taglib, which will help you a lot and you dont have to reinvent the wheel smile
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Nov 24, 2008 7:21:44 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Show Printable Version of Thread  Post new Thread