*
The moose likes Other Application Frameworks and the fly likes [Stripes] taglibs for select field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "[Stripes] taglibs for select field" Watch "[Stripes] taglibs for select field" New topic
Author

[Stripes] taglibs for select field

Gabriele Fabbri
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Hi,

I have a select form field generated using Stripes' taglib.
It's mapped to a List of objects generated inside the ActionBean.
Everything is working fine, but I can't understand if it is possible to fix the field to a specific value if it correspond to the value of a property of the current object.
I'm looking at the reference but there are no attributes that sound useful for this.

Thank you,
Gabriele Fabbri


OverZero Software
[url]www.overzero.it[/url]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Generally, if an object is populated the select tag will display the selected element based on the object's value, if things are mapped correctly. Can you show us a bit of the code to look over?


GenRocket - Experts at Building Test Data
Gabriele Fabbri
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Gregg Bolinger wrote:Generally, if an object is populated the select tag will display the selected element based on the object's value, if things are mapped correctly. Can you show us a bit of the code to look over?


Unfortunately I cannot post any code at the moment because I'm working on a different machine.
In any case, this is the situation:

I have a very simple object News that contains several properties like Title, Text, etc...
In the actionbean that forward to the form to edit the news I create a List of NewsCategories, that is used in the jsp to populate the select field.
This field is used to move the News I'm editing to a different News Category. Obviously the News I'm editing is already related with a category (this information is stored in the newsCat property of the News object).
I would like that if the current News is child of the NewsCat with Id 2, the same value is marked as selected in the select form field.
Am I working in the wrong way for some reason?

Thanks,
Gabriele Fabbri
 
 
subject: [Stripes] taglibs for select field