struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pramo...@in.efunds.com
Subject Re: error handling
Date Fri, 27 Jun 2003 09:59:50 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



                                                                                         
                         
                    "Prashanth.S"                                                        
                         
                    <suman291857@y       To:     Struts Users Mailing List <struts-user@jakarta.apache.org>
       
                    ahoo.com>            cc:                                          
                            
                                         Subject:     Re: error handling                 
                         
                    06/27/2003                                                           
                         
                    03:14 PM                                                             
                         
                    Please respond                                                       
                         
                    to "Struts                                                           
                         
                    Users Mailing                                                        
                         
                    List"                                                                
                         
                                                                                         
                         
                                                                                         
                         




Hi pramod,
you once thoroughly take a look at actionerror and actionerrors docs.
If u want to route ur errors to the parent page,
give the following statement in your action class.

actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.tx.incomplete"));
   saveErrors(request, actionErrors);
   return (mapping.findForward("failure"));

Than in struts-config.xml,Add the following line.

<forward name="failure" path="/vascdt/StaticUpLoad.jsp" />
        </action>


Than in your jsp type down the following
<html:errors />

The above thing works for ActionErrors.GLOBAL_ERROR.If u want to handle individual errors
u have to
do minor modifications which any good struts tutorial can explain.Thats very simple.


Hope this helps.
Cheers
Prashanth




Pramod.P@in.efunds.com wrote:

Hi,
Can anyone send me a solution for the following problem:
>From two jsps, I am coming to the same action class. (in the first jsp, I have a link,
clicking on
this will go to an action say MyAction. From the second jsp also, I can goto the same action
MyAction). In the MyAction class, how do I write code to return to the parent page when error
occurs. (I am catching error using ActionErrors)
path = "/MyAction"
type = "mypackage.MyAction"
name = "myFormBean"
scope = "session">





Here, if the forward is success, i am able to got Result.jsp. But if any error is there, how
do I
display the error in the parent page? (I can come to this action from two different parent
page)
Please advise.


Thanks,


Pramod










********************************************
This electronic mail message is intended solely for the named recipients and may contain
confidential and proprietary business information of eFunds Corporation and all its subsidiaries.
If you are not a named recipient, please notify the sender immediately. You may not disclose
the
contents to any other person; use this electronic mail message or its contents for any other
purpose; or further store or copy its contents in any medium
********************************************


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



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!



********************************************
This  electronic  mail  message  is  intended  solely  for  the  named  recipients  and  may
contain
confidential  and  proprietary  business information of eFunds Corporation and all its subsidiaries.
If  you  are  not a named recipient, please notify the sender immediately.  You may not disclose
the
contents  to  any  other  person;  use  this  electronic  mail message or its contents for
any other
purpose; or further store or copy its contents in any medium
********************************************


---------------------------------------------------------------------
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