File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts validation output problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply 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
 
IntelliJ Java IDE
 
subject: struts validation output problem
 
Threads others viewed
Unable to validate minlength
Struts Validator Configuration
Problems wih validateUrl method
Help with simple validation problem in Struts
Have any problem using validator
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture