Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Struts validate method: I18N error messages

Reply
Thread Tools

Struts validate method: I18N error messages

 
 
Klaus
Guest
Posts: n/a
 
      07-02-2003
I have an error message like "{0} is ..." (Resources).

See code below:
The part "key.x.z" is taken from the resource bundle (fine)
The replacment {0} is displayed as it is: "key.x.label" (bad)
=> How can I make the second part being internationlized too?

I work-around the problem by manually getting the bundle by using
PropertyResourceBundle. I do not like it, because when I change the
resource bundle in struts-config.xml the Java code becomes
inconsistent with the config file.

Possible solutions:
Directly access the default bundle from within validate, but how?

Code Example:
=============
public ActionErrors validate(ActionMapping m, HttpServletRequest r) {
ActionErrors errors = new ActionErrors();
if (....)
errors.add("person", new ActionError("key.x.z", "key.x.label"));
return errors;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts I18N Tim Slattery Java 2 03-21-2013 08:11 PM
Authenticating an UTF-8, I18N field in struts using regular expressions los Java 29 09-25-2005 09:42 AM
Struts....I18N and encoding? eeyimaya Java 1 02-17-2005 04:33 PM
i18n - Newlines in ResourceBundle messages Rhino Java 2 12-22-2003 08:20 PM
sample struts w/ I18N and validator David Thielen Java 0 08-02-2003 02:07 AM



Advertisments