tags:

views:

40

answers:

1

i am using the redy made paging tags.B But it give me a error of null pontinter exception. the first page is displayed correctly.But when i click next it gives the error

<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %> <%

Iterator i = null; Set tutorials = (Set ) request.getAttribute("tut_lst"); request.setAttribute("tut_lst",tutorials);

i = tutorials.iterator(); // error occus here

%>

<%

   while(i.hasNext())
   {
       Tutorials t = (Tutorials)i.next();

%>

        <BR> <a href ="down?tid=<%out.println(t.getUploadid() );%> ">        <%out.println(t.getFilename()); %> </a></td>

    </pg:item>

<%

      }

%>

<pg:first>
  <a href="<%= pageUrl %>">[ (<%= pageNumber %>) |&lt; Previous ]</a>
</pg:first>

<pg:prev>
  <a href="<%= pageUrl %>">[ (<%= pageNumber %>) &lt;&lt; Previous ]</a>
</pg:prev>

<pg:pages>
   <a href="<%= pageUrl %>"><%= pageNumber %></a>
</pg:pages>

<pg:next>
  <a href="<%= pageUrl %>">[ Next &gt;&gt; (<%= pageNumber %>) ]</a>
</pg:next>

<pg:last>
  <a href="<%= pageUrl %>">[ Last &gt;| (<%= pageNumber %>) ]</a>
</pg:last>

A: 

It looks like the new request isn't getting the tut_lst attribute.

Are you getting a null pointer exception?

edit: normally an attribute is set in session scope. Is there a reason you don't want to do this?

Zack
ya i am gettin null ptr exception when i click on next button to get the second set of results ie the next page.
if its not getint the tut_lst then how come its displying the first page
Bescause they are two different requests to the server.
Zack
whats is the solution?
normally an attribute is set in session scope. Is there a reason you don't want to do this?
Zack
it works fine if i set the attribut in session. but is it the right way to do? i am using strust framework. Initially i was setting the attribute in request in my action class and the calling the jst to display the results.