Struts Auto Validation Message in Different Locale Format
posted 10 years ago
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.