This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Spark in Action and have Jean-Georges Perrin on-line!
See this thread for details.
Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

I18N struts tag value

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
One more question on I18N to complete this project.
What is the syntax to internationalize/localize the value="xx" in all the strut tags? I have tried <html:text property="field0" value="${myMessagResourceBundle.field0.label}"/>, which doesnt work. I also tried eliminating it entirely and setting it in the formBean reset(), which also didnt work. Where am I wrong? tia.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One feature of Struts tags that's not very well documented is the fact that if you provide a body for the tag, it will be used in the place of a value attribute. So, in your example, the following should work:


I normally don't like to set values for fields in the JSP, though, because it doesn't work for validation. If the JSP is redisplayed due to a validation error, the value will show as the default value, not the value the user entered.
[ December 20, 2007: Message edited by: Merrill Higginson ]
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:
One feature of Struts tags that's not very well documented is the fact that if you provide a body for the tag, it will be used in the place of a value attribute. So, in your example, the following should work:


I normally don't like to set values for fields in the JSP, though, because it doesn't work for validation. If the JSP is redisplayed due to a validation error, the value will show as the default value, not the value the user entered.

[ December 20, 2007: Message edited by: Merrill Higginson ]



Hi
Excellent edification, on both.
I defer to your experience with the validation. This is just for proof of concept. The difficulty was that I was trying to set the value of strut tags that are not input, i.e. button, submit, so if they are hardcoded for their localization that is actually fine on validation. It works great. Thank you.
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic