Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i18n

 
Garandi Smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Reader,
In properties file I have the following

message.alphanumeric = A {0} contains only letters and numbers.

where {0} is replaced with the 2nd argument of

ActionError("message.alphanumeric", "Registration Number"); object.

However if I have message.alphanumeric in a different language, how to modify
ActionError(), to pick "Registration Number" in proper language from a properties file, instead of hard coding it?
Thanks in advance
Garandi
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the getResources() method in your Action superclass.

ActionError("message.alphanumeric", super.getResources(request, "registration.number.label"));

This method will get the message using the current locale, just as a <bean:message> would.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic