Gerard Kelly

+ Follow
since Mar 22, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gerard Kelly


I'm having a small problem with the pagination message that displaytag is outputting for me. I'm performing pagination via the partialList method but the "displaying items X to Y" does not display correctly.

The flow is as follows:

1. user performs a search
2. query the database for the count of matching records
3. pull the correct records from the db based on the displaytag page number and number of items to be displayed at a time.
4. Set the list of items return into a dynamic struts form

However, say my query returns 15 records and we display 5 records at a time, the first page will display the message:

"15 Items found, displaying 1 to 5."

But if the user clicks onto page 2, then the same message is displayed (the row data, however, is paginated correctly).

Can anyone suggest what the problem exactly is here? PartialList is set to true on the displaytag html tag.


a kishore wrote:
Hi Gerard,

I think you can pass parameter in requestURI, either for same action or for different action. Then by using that parameter you can call different method based on if-else condition is it ? If you are not sure how to pass parameter, you can pass like this:

I hope this can help you.


Perfect! Thanks so much Kishore!
12 years ago
It would seems as though I can hit a new Struts action but not a new method. For example, if I first hit a method called searchAllTypes then this method is constantly being hit for pagination despite changing the RequestURI....

Any help very much appreciated.
12 years ago


I'm trying to implement displaytag pagination with a little different funcitonality. Basically, I have 3 displaytag tables on my jsp, and when the user wishes to see the next set of results on one of them it brings them to a new resultant jsp which only displays the info from the table they wished to paginate.

This should be relatively simple to do. However when the user clicks a pagination link, displayTag hits the ORIGINAL struts action that it used in displaying the original data. I want to be able to hit a new struts action.

I don't think I've explained that terribly well so heres a little example.

1. User does a search.
2. A struts action called 'searchAllTypes' is hit and returns a jsp.
3. Results for 3 different types (x,y and z) are displayed in 3 seperate tables.
4. User wishes to see the next 10 results for table y so clicks 'next' on y's table.
5. A struts action called 'searchYType' is hit and returns a new jsp.

Thanks to anyone who can help me with this.

12 years ago

I'm writing the value of a nested property to an outputted jsp. The date is of type Date which displays something like:

2009-10-25 18:02:05.0

But I wish to print it out in a dd/mm/yyyy format, ie. the above would become:


Can anyone tell me how to do this? From what I've read on the nested taglib theres no way of doing it as easily as bean:write.

12 years ago

I'm trying to paginate through a List of items using displaytag and Java Stripes but it doesn't seem to work correctly. Everything is working fine but when I click the link for say the 2nd page of results, it does not paginate - ie. the first 2 results are being shown again. Can anyone help?

Here is the jsp code:

And the corresponding TenderActionBean:

The above class extends TenderBaseActionBean which holds the results set - the declaration looks like this:

When I click on pagination link, the searchByTitle (or searchByDescription) action is hit and the search is performed again - is this supposed to happen? The link works correctly (ie. it appears that the second page is being displayed as Page 2 link cannot be clicked) but like I said, the results are incorrect.

Any help with this would be great guys, thanks.
Bump. Can anyone help me out with this?
Sure, here is

And here is in full:

The above actionBean extends ProductBaseActionBean which looks like the following:

Thanks again for helping with this!
Hi Frederic,

thanks for that and congrats on a great book!

I'm still having a little trouble with my edit action though.

For starters, my edit action is for a model which references other objects. Although your Stripes book says "If your model objects use other model objects, that’s no problem either—Stripes happily uses deeply nested properties," I can't find an example into how this is implemented.

What I'm trying to do is the following:

And then in the jsp, I'd like to do the following:

The above jsp code is used for both the create and edit actions (same code, but different files if you know what I mean). However, the values for Manufacturer id or the product categories will not get passed through this way. But when I change the above code to look like this:

They will get passed through. Unfortunately, when I go to edit my product the product name and description get populated but the other fields do not (ie. the dropdown defaults to the first option and the multi-select box does not highlight any of the previous entries.

I'd really appreciated it if you could help me out here.

Many thanks,

I'm trying to implement what I thought would be a very simple action with the Stripes framework. I used the @Wizard annotation to perform my "Create" action and it works well but when I try to use this for the edit action (ie. pass in the ID of the object to edit), I get the following error:

"Submission of a wizard form in Stripes absolutely requires that the hidden field Stripes writes containing the names of the fields present on the form is present and encrypted (as Stripes write it). This is necessary to prevent a user from spoofing the system and getting around any security/data checks."

Does anyone know a way around this? I'd love to keep using wizard as there are a LOT of inputs in my create/edit actions and it handles a lot of the hard work ;)

Thanks in advance,

I'm still getting used to Hibernate but am currently having a little bother with deleting an object in a many-to-many relationship.

The functionality I have between the two models is pretty basic. Lets just say the two models are Product and Category, so many products can have many categories and vice versa.

If I delete one product, I do not wish to delete the categories it references and vice versa. The two tables use an association table since its a many-to-many relationship.

I've tried several different CascadeTypes and none seem to work correctly.

Using cascadeType.MERGE produces the following error:

Cannot delete or update a parent row: a foreign key constraint fails

CascadeType.ALL deletes more than 1 row incorrectly (ie. a record in the same table if they share a common attribute)

Using NO cascadeType returns the following error:

org.hibernate.ObjectDeletedException: deleted entity passed to persist manyToMany

and CascadeType.PERSIST throws an exception also:

org.hibernate.TransientObjectException: object references an unsaved transient instance

Then if I specify the following on BOTH models:

@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "products")

I get an error also:

java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`lportal/ten_category_product`, CONSTRAINT `FKEF22751352CAE5BF` FOREIGN KEY (`product_fk`) REFERENCES `ten_product` (`id`))

Sorry for the long-winded explanation but if anyone could help with this, I'd more than appreciate it!