Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • 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
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
It work if you use html tag but not if you use struts tag.
Thanks
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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 <htmlption> 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic