|
| Index | Recent Threads | Unanswered Threads | List Polls | Public Albums | Who's Online | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 5 |
|
| Author |
|
|
Stranger India Joined: May 5, 2004 Post Count: 2 Status: Offline |
Hi, I'm very much urgent to have the pagination code using jsp. Plze help me. |
||
|
|
mvnForum Developer ![]() Joined: Apr 7, 2004 Post Count: 56 Status: Offline |
What is your question? Where are you having a problem? Can you give some details? Dr. A> |
||
|
|
mvnForum Developer Vietnam Joined: Oct 16, 2002 Post Count: 2956 Status: Offline |
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 ![]() ---------------------------------------- Minh Nguyen mvnForum Developer Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com http://www.DienDanLinux.org |
||
|
|
Stranger Joined: Nov 21, 2008 Post Count: 1 Status: Offline |
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"> <% out.println(resultset.getString("staff_name") ); %></td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("designation") ); %></td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("email") ); %></td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("address") ); %></td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("city") ); %> </td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("country") ); %> </td> <td bgcolor="#FFDEB0"> <% out.println(resultset.getString("contact_no") ); %> </td> <td bgcolor="#FFDEB0"> <% 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> |
||
|
|
mvnForum Developer Vietnam Joined: Oct 16, 2002 Post Count: 2956 Status: Offline |
Hi shashi, I would suggest you use the pager taglib, which will help you a lot and you dont have to reinvent the wheel ![]() ---------------------------------------- Minh Nguyen mvnForum Developer Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com http://www.DienDanLinux.org |
||
|
|
|
|
|
Current timezone is GMT Jan 7, 2009 5:16:37 PM |


