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 DynaActionForm not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaActionForm not working" Watch "DynaActionForm not working" New topic
Author

DynaActionForm not working

Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
Hi All,

I've created one form and trying to use dynamic form validation but instead any messages I'm getting "<ul><li></li></ul>".

In struts-config.xml



My AddressDynaAction class is as follows:


My DynaAddress.jsp file is as follows:


Please help.

[ November 20, 2007: Message edited by: Asha Pathik ]

[ November 20, 2007: Message edited by: Asha Pathik ]
[ November 20, 2007: Message edited by: Asha Pathik ]

SCJP 1.5
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
What's in your ApplicationResources.properties file? Do you have the following messages defined?

errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
errors.range={0} is not in the range {1} through {2}.
errors.required={0} is required.
errors.byte={0} must be an byte.
errors.date={0} is not a date.
errors.double={0} must be an double.
errors.float={0} must be an float.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.short={0} must be an short.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.


Did you define the validator plugin in your struts-config.xml file? Did you define validations in a validator.xml file?

For more details, read the Struts Validator Guide.

Also, if you're going to use JavaScript to display the errors (not recommended), you need to remove the errors.header, prefix, suffix, and footer.
[ November 21, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
My MessagesResource file is as follows:

And one more question, do we've to define anything in validation.xml file for "Dynamic validation"?
[ November 21, 2007: Message edited by: Asha Pathik ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
All Struts Validation Framework validations are by definitinon "dynamic validations". You must define each validation you want performed in the validation.xml file. If you don't know how to do this, click on the link for the Struts Validation Guide that I gave you in my previous post, and read it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DynaActionForm not working