aspose file tools*
The moose likes Struts and the fly likes JSTL paging error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSTL paging error" Watch "JSTL paging error" New topic
Author

JSTL paging error

pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
I have this code below, which suppose to perform paging to lists of data retrieved from a bean. However, when i run it i received this exceptions below. Anyone can give me any hint? it will be fully appreciated

My code:

Exceptions displayed:
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I believe the problem is in these two lines:

<bean:define id="PositionBean" name="posisi_list" type="com.evisitek.position.PositionDTO"/>
<bean:size id="positionBean" name="PositionBean" />

The bean:size tag also defines a bean. You're using the same name for two different bean values. I'd suggest changing your bean:size tag to:

<bean:size id="positionBeanSize" name="PositionBean" />

Remember to change references to it later on in the page.


Merrill
Consultant, Sima Solutions
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Thanks, I've changed my code like shown below, however i still got exceptions

Is there other way to perform paging beside using JSTL?



Exceptions:
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This exeption seems pretty obvious. "No valid collection specified for size tag" means that your <bean:size> tag is not referring to a collection. Fix it so that it is.
Is there other way to perform paging beside using JSTL?

You might look at The Display Tag Library. It offers some controls that have automatic pagination.
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Thank's a lot for the reference
However, i changed my tag to get the bean size like this
<bean:size id="pb_list" name="PositionBean" collection="posisi_list"/>
"posisi_list" is the name of the List type of data which stored in request scope.
When i run the program it's still display the same exceptions, is it allowed to use List as the value for the collection?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is the link to the documentation on the <bean:size> tag. As you will read, "collection" should only be used if you're using a scriptlet that evaluates to a collection. Use name to refer to the bean and optionally property to refer to the getter to be called to retrieve the collection.

So, if you specify name="PositionBean" and property="posisi_list", Struts will find PositionBean in some scope and call the getPosisi_list() method on it to get the collection.

If you have a collection in a scope with the name "posisi_list", you should simply specify:

<bean:size id="pb_list" name="posisi_list" />
[ August 10, 2006: Message edited by: Merrill Higginson ]
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Thanks a lot for the feedback, my lists are finally shown at the page
However, when i click the next page it shows an exceptions like this below

type Status report

message /posisilihat.jsp

description The requested resource (/posisilihat.jsp) is not available.

I have set c:url value="posisilihat.do"> but it's not working and when I tried to change it to "posisilihat.do?action=POSISI_LIHAT" it result an error, any clue? it will be fully appreciated

here is my code once again

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Try adding a "/" to the value in your <c:url> tags, making them:

value="/posisilihat.jsp"

This is a clue to the c:url tag that it needs to append the context path to your url.
pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
Thanks a bunch my lists are finally paged correctly
Anyway, I've tried to explore Display Tag and I have this code below which intended to export data displayed in my page into Excel and Pdf format.
When i run the web, the excel files i've downloaded only show the table header, the fields are empty.
Could you tell me is there any mistake on my code? thanks in advance


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL paging error