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.
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?