I am coverting our site that has internationalization to an MVC architecture instead of just tiles. To do this Ive decided on using
struts & tiles. Im truly a beginner at struts and struggling a little with the internationalization / validation. I must say though the OGNL is a powerful and intuitive tool.
My problem is I want to get rid of the 50 or so files javascript script include files we are using for validation and let the server do the work. I have set up a very simple example and for the life of me cant figure out how to internationalize the validation.
--- The form --
<s:form name="loginform" action="loginuser" method="post" enctype="application/x-www-form-urlencoded" >
<s:textfield name="username" label="%{getText('LBL_LOGIN_USER')}"/>
<s:password key="LBL_LOGIN_PWD" name="password" label="%{getText('LBL_LOGIN_PWD')}"/>
<s:submit />
</s:form>
-- The Login-validation.xml --
<validators>
<field name="username">
<field-validator type="requiredstring">
<message key="username.required"/>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message key="[Password is a required field.]"/>
</field-validator>
</field>
</validators>
-- the properties file in the classes folder --
password.required = Password is a required field.
username.required = User Name is a required field.
So the question is what is the most elegant solution to get my validation internationalized?
I prefer to keep the validation out of my Actions. Some of the validation needed is quite complicated and I am really keen to use the struts functionality to simplify it with regular expressions. I am also looking forward to some of the built in functionality such as date ect.
Thanks,
Earl