Thanks Tim.This too makes good sense..thanks 



"Chen, Gin" <[EMAIL PROTECTED]>
10/24/2003 02:45 PM
Please respond to "Struts Users Mailing List"

 
        To:     "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: Multiple error pages from validate method


Here's another way that I can think of:

I'm assuming you will have 2 actions (one for add and one for edit) or a
single action that uses a lookupdispatch add/edit handling.
In either case don't have validate="true" in your struts-config but rather
do the validation from your action method:
public ActionForward addAction(....)
{
      ActionErrors errors = myBean.validate(...);
      if( errors != null && !errors.isEmpty())
      {
          return aMapping.findForward("ERROR_PAGE_ADD");
      }
}

Do the same for edit.

Of course there are a lot of other ways to do this as well.
-Tim

-----Original Message-----
From: Geeta Ramani [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 3:36 PM
To: Struts Users Mailing List
Subject: Re: Multiple error pages from validate method


Here's one "hacky" way of doing this:  Set a request attribute, something
like "goToErrorPage2" right after you validate. On the top of the error 
page
if that attribute goToErrorPage2 is nonnull, then forward to the second
error
page else simply render the "normal" error page..

[EMAIL PROTECTED] wrote:

> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config 
file
> as input parameter?
>
> Can somebody help??


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to