highlander1536
asked on
Struts and external javascript files
Hi,
I use the Struts 1.1 Framework and I want to use external javascript files to validate my forms.
But the files depend on the Locale of the Web browser. If it's ES --> src="js/es/myfile.js" and if it's US --> src="js/us/myfile.js"
Unfortunately there is no tag "srckey" with Struts 1.1.
Any suggestions ?
Thanks a lot in advance,
Highlander1536
I use the Struts 1.1 Framework and I want to use external javascript files to validate my forms.
But the files depend on the Locale of the Web browser. If it's ES --> src="js/es/myfile.js" and if it's US --> src="js/us/myfile.js"
Unfortunately there is no tag "srckey" with Struts 1.1.
Any suggestions ?
Thanks a lot in advance,
Highlander1536
In struts, you should be using Action.getLocale() to get client's current locale. Based on current local, you should try to see if the a js file exists, if not you should fall back to default js file.
Let us know if you have further enquires.
Let us know if you have further enquires.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, thanks a lot.
Last question : do you know where I can download some usefull validator-rules.xml ?
Last question : do you know where I can download some usefull validator-rules.xml ?
Thanks for the points :)
If you look in the validator-rules.xml that comes with Struts validator, you see that there are already basic validators in it. These should help you, to create your own validators. Basic validators are required, mask, range, maxLength, minLength, date, creditCard, email, byte, short, integer, long, float, double.
I don't know where you can download other examples.
Hope this helps.
Greetz,
Didier
If you look in the validator-rules.xml that comes with Struts validator, you see that there are already basic validators in it. These should help you, to create your own validators. Basic validators are required, mask, range, maxLength, minLength, date, creditCard, email, byte, short, integer, long, float, double.
I don't know where you can download other examples.
Hope this helps.
Greetz,
Didier
http://www.w3.org/International/questions/qa-accept-lang-locales.html
What does:
<%
String bigLoc = request.getHeader( "accept-language" ) ;
out.println( "<b>" + bigLoc + "</b>" ) ;
if( bigLoc != null && bigLoc.length() > 2 )
bigLoc = bigLoc.substring( 0, 2 ) ;
out.println( "<tt>" + bigLoc + "</tt>" ) ;
%>
give you?