You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ovidiu EFTIMIE <oe...@assemblee-nat.fr> on 2003/12/17 19:01:17 UTC

Targeted forward

Hi,
I have an abstract  base Action class which calls an abstract method called
executeAction. All my Actions implement the executeAction method.
//Snip from BaseAction class

public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest request,HttpServletResponse response)throws Exception {
ActionForward forward = null;
try {
    forward = executeAction(mapping,form,request,response);
} catch (Exception e) {
    ActionErrors errors= new ActionErrors();
    ActionError error = null;

    if(e instanceof BaseException){
        BaseException lex = (BaseException)e;
        error = new ErrorMessage(lex.getMessage());
        forward = new ActionForward(mapping.getInput());
        errors.add(lex.getType(),error);

}else{
    if(e.getMessage() != null){
        error = new ErrorMessage(e.getMessage());
    }else{
        error = new ErrorMessage(Constants.DEFAULT_MESSAGE);
    }
    forward = mapping.findForward("systemError");
    errors.add(Constants.BLOCKING,error);
}
    saveErrors(request,errors);
}
return forward;
}

//--end snip

So as you can see in case of exception I do a forward to the  input page. The
thing is that there are several cases in which I don't want forward to the
input, and that's beacuse I have a master page which triggers submits on an
iframe. So if there is an error in the iframe page the input (that means the
master page) will be displayed in the iframe ... and that wouldn't look very
nice.

So my question is:   is there any way that I can get the input page to be loaded
in the _parent and not in the iframe,  in case of an error?



Thanx,

Ovidiu


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