• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Struts Auto Validation Message in Different Locale Format

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one application in two languge version, English and French. The application using the struts' validation framework. One ActionForm called 'LoginForm' with two properties: userID and password. They are defined in the
validtion.xml
<form name="loginForm">
<field property="userID" depends="required">
<arg0 key="form.login.userID" />
</field>
<field property="password" depends="required">
<arg0 key="form.login.password" />
</field>
</form>

In application two resouce properties files (Engish and French), the following two keys are defined in English version:
form.login.userID=User ID
form.login.password=Password

the following two keys are defined in the French version:
form.login.userID=Identification de l'utilisateur
form.login.password=Mot de passe

When the user submit the login form without any input for these two fields, the page use the following code to display the message auto generated by struts framework.

<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</logic:messagesPresent>

---> out put in English is expected.

* User ID is required
* Password is required

At the beginning of the application's action execute method, the following method is called to set the session Locale if the locale is not default one: English.
setLocale(request, Locale.FRENCH);

However, when the user's Locale selection is French
and submittion the same login form without entering any data for user ID and his/her password, the out put message will be:

--> out put in French is not expected:
* Identification de l'utilisateur is required
* Mot de passe is required

My real question is: what we need to do for the struts to change the auto attached 'is required' message in the French version?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic