• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XML Validation in struts

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic