• 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

set html option value by bean: message key=...

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have select box in my page .I want that value attribute of <html ption > is written by <bean:message key="ddd"
For e.g.

But it gives error quote symbol expected .
Thanks
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
It should be <html ption value="<bean:write..../>">
Regards,
Roshani
 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But then it output "<bean message........." as value and not which is specified in property file.
Thanks
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Try using HTML tag. eg <option value="<bean:write..."/>
Actually it worked for me in case of text values. <input type="text value="bean:write.."/>
Reagrds,
Roshani
 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It work if you use html tag but not if you use struts tag.
Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, you can't embed one Struts tag inside another. That's why it works for a regular <option> tag but not for an <html:option> tag.

Secondly, using a message key for an option value is generally a really bad idea.

If this is an i18n application, the value will be different for each language. This means that in your Aciton class, you have to check for the value in each language to tell what action to take. Better to make the value a single string that is the same regardless of which language is being used.

The only situation where this would be useful is if you're storing the value in the database differently depending on the language spoken by the user.
[ October 13, 2006: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic