• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

changing the struts validate return page

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am trying to change the page that struts redirects to upon a
validate error.
Normaly you are returned to the source page with errors to show,
However I want to be redirected to a page of my decision.
Does anyone have a clue?
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not very sure what the recommended practice is right now but prior to version 1.1, you could invoke ActionMapping.setInput(). Then in the pre-release 1.1, that method threw an IllegalStateException(?) or something like that if any attempt was made to modify the input attribute of an ActionMapping that had already been initialized by Struts from the configuration file, which would be the normal case. Looking at the final release of the JavaDocs however, the exception declaration seems to be gone and looks like setInput() has been "reinstated" as the way to make the return form more dynamic.
(If anyone knows otherwise, please correct me )
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In struts-config locate your corresponding action tag. You can add an attribute to this tag of input="myErrorPage.jsp"
I don't know if a worse name could have been created for this attribute but it works. Whenever the validate method of your form doesn't like something your user will be sent the page you specify as input.
reply
    Bookmark Topic Watch Topic
  • New Topic