This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts validation output problem

 
rick collette
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using struts validation, I defined error messages in a resources
file:
error.input.invalid.moneyAmount1=Money about is not valid.

And the following is from my validation.xml file (validation and validation-rules are merged):
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
msg="errors.required">

......
<field property="moneyAmount" depends="required">
<msg name="required" key="error.input.invalid.moneyAmount1"/>
</field>
.....

but I got the following when doing validation:
???en_US.error.input.invalid.moneyAmount1???

I am wondering what could be wrong?

regards,
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Messages are shown in this format possibly due to one of the following:
- message not present in message resource file
- message resource file not in correct location

Check if the message resource file is in the correct folder under WEB-INF/classes. It should match the entry specified in struts-config.xml.

If your struts-config.xml has this entry,
<message-resources parameter="resources.ApplicationResources">
then your message resource file should be at
WEB-INF/classes/resources/ApplicationResources.properties

Note: Prior to struts 1.1, you could specify the location of the message resource file in the web.xml
 
rick collette
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, great diagnostic suggestions. I am using old struts.


Originally posted by Sheldon Fernandes:
Messages are shown in this format possibly due to one of the following:
- message not present in message resource file
- message resource file not in correct location

Check if the message resource file is in the correct folder under WEB-INF/classes. It should match the entry specified in struts-config.xml.

If your struts-config.xml has this entry,
<message-resources parameter="resources.ApplicationResources">
then your message resource file should be at
WEB-INF/classes/resources/ApplicationResources.properties

Note: Prior to struts 1.1, you could specify the location of the message resource file in the web.xml
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic