You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Mulligan <da...@LECAN.ie> on 2002/12/11 14:00:11 UTC

RE: SOLVED common validation error page

Solved by overriding the RequestProcessor and inserted the below code.

Now, if we got validation errors the request is forwarded to the form input
(if it exists),
otherwise to the validation_error forward.

// Has an input form been specified for this mapping?
String input = mapping.getInput();

//START MODIFIED CODE
if( input == null) {
  // Has a validation_error forward been specified for this mapping?
  ForwardConfig validationError = mapping.findForward("validation_error");
  if( validationError != null ) {
    input = validationError.getPath();
  }
}
//END MODIFIED CODE





-----Original Message-----
From: David Mulligan [mailto:david.mulligan@LECAN.ie]
Sent: Wednesday, December 11, 2002 9:57 AM
To: Struts-User (E-mail)
Subject: common validation error page


Got a quick validation question.

All validation errors that occur from action forms are to be displayed on a
common error page. Not the input page of the action! 
How do I setup the validator to forward to this common error page when there
are problems?


e.g. Something like the below will work

  <action path="/logon"
    type="ie.lecan.core.web.authentication.actions.LogonAction"
    name="/authentication/logonForm"
    input="/pages/common/errors.vm"
    scope="request">
    <forward name="success"		path="/myWorkspace.do"/>
  </action>

but I prefer not this for two reasons 

1. the input should really be /pages/logon.vm and may confuse developers
etc. later.
2. it's a pain having to set input="/pages/common/error.vm" for every
action.

Any ideas would be greatly appreciated
dave.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>