aspose file tools*
The moose likes Struts and the fly likes XML Validation in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "XML Validation in struts" Watch "XML Validation in struts" New topic
Author

XML Validation in struts

Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
Hello I am new to validating struts with xml (validation.xml file).

I seem to have done everything correct except that when an error occurs I want it to forward it to a page "error.jsp".
Right now when the validaion is correct it goes to a page "success.jsp" which is good. But when a validation error occurs it throws an exception
(how do I forward it to error.jsp)
I have also created a FORWARD with the name of 'error'. But how do I write the code in the Action Class to say that when there is a validation error use this forward (error) otherwise use the succcess forward?

Thanks!!
Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
Ok I got it..

I had the action path set to validate user input.
When validation fails, Struts looks in its action mapping for the "input" attribute value which tells it where to go when validation fails.
Apparently I did't have an inputattribute defined for my
/login action mapping.
 
Consider Paul's rocket mass heater.
 
subject: XML Validation in struts