• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[Stripes] taglibs for select field

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic