aspose file tools*
The moose likes Struts and the fly likes struts validation output problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts validation output problem" Watch "struts validation output problem" New topic
Author

struts validation output problem

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
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

Joined: Aug 18, 2004
Posts: 157
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

Joined: Mar 22, 2002
Posts: 208
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
 
subject: struts validation output problem
 
Similar Threads
Problems wih validateUrl method
Have any problem using validator
Help with simple validation problem in Struts
Unable to validate minlength
Struts Validator Configuration