struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas De Loof" <nicolas.del...@cgey.com>
Subject Re: error handling
Date Fri, 27 Jun 2003 10:14:18 GMT
>
> But by doing in this way, for the forward name="failure" I will always end up in StatuicUpload.jsp
> (for the below example) I don't want to goto that jsp. I need to goto the parent page.
> Let me explain the scenario once again. From two different jsps (say a.jsp and b.jsp)
I am coming to
> an action (bt clicking the link in each jsp). From this action, upon an error I want
to go back to
> "a.jsp" (if the request came from a.jsp)  or to b.jsp (if the request came from b.jsp).
So here I
> won't be able to  hard code the path either as "a.jsp" or as "b.jsp" in the struts-config.xml.
In
> you example upon error, it will always forward to StaticUpload.jsp
>
> Thanks,
> Pramod

If you really cannot set multiples action-mappings in struts-config.xml (that is the cleaner
way to do), you can add a
parameter to your request for the "incoming" JSP :

    <html:hidden name="from" value="/a.jsp"/>

and build a new forward in your action when errors occurs :

    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        String commingFrom = request.getParameter("from");
        return new ActionForward(from);
    }


Nico.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message