You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jalal udeen <ja...@gmail.com> on 2007/05/04 10:14:44 UTC

pagination problem in jsp

hi  all

I have to use pagination in jsp  so i did it with logic:iterate  tag as
follows but when i use  2 links   next and previous

but next link is not disspearinng when it reaces the last one can any help
me for this

the code follows


<%
  String strOffset ="0";
    if(request.getParameter("pagination")!=null)
     strOffset=request.getParameter("pagination");
     else
    strOffset ="0";
    String strLength = "2";
    int increment = Integer.parseInt(strOffset) + Integer.parseInt(strLength)
;
    String strIncOffset = String.valueOf(increment);
      ArrayList list  =(ArrayList)request.getAttribute("pattern");
 int size= list.size();

    if((Integer.parseInt(strIncOffset)>= size))
     strIncOffset ="0";

%>

*Logic tags*

<logic:iterate id="user" name="pattern" scope="request" type="
com.pa.pattern.helper.Helper" offset="<%=strOffset%>"
length="<%=strLength%>">

* Links*



*Next Link:*

**



     </tr>
<%


if(Integer.parseInt(strOffset)!=size &&  !((Integer.parseInt(strOffset)>size)
) && !(Integer.parseInt(strLength)>=size) )

{


%>
<table align="right">
 <TR><TD ALIGN=""><a href="viewpattern.do?pagination=<%=strIncOffset%>"
>Next</a></TD>
<%
}

%>





*prev Link*

**

<%


if((strIncOffset.trim().equals(String.valueOf(size)) ||
Integer.parseInt(strOffset)
>0   ) && !(Integer.parseInt(strLength)>=size))
{
 strIncOffset=String.valueOf(Integer.parseInt(strOffset)-2);

%>

<TD><a href="viewpattern.do?pagination=<%=strIncOffset%>"
>Prev</a></td></tr>
<%
}%>



pls i need a help for this



thanks

jalaludeen