File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Stripes] taglibs for select field

 
Gabriele Fabbri
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Gabriele Fabbri
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic