If you decide to do a forward, look at Struts transaction tokens to ensure
that the delete operation doesn't get executed when the user hits refresh on
the resulting page.  Of course there may no longer be any data to delete, but
you might reservations about allowing DB operations to be retried after
they've already executed.


--- "Au-Yeung, Stella H" <[EMAIL PROTECTED]> wrote:
> Thanks Vincent and Hubert, I will try both your suggestions....
> 
> -----Original Message-----
> From: Vincent Lin [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 03, 2004 11:01 PM
> To: Struts Users Mailing List
> Subject: RE: Action not forwarding to another Action
> 
> 
> It is my opinion. Please correct me if I am wrong.
> 
> The JSP "DeleteOrder.jsp" submits to
> "/app/DeleteOrder.exe", 
> Therefore the parameter "orderNumber" can be seen in
> "/app/DeleteOrder.exe".
> After the part is deleted the action "/app/DeleteOrder.exe" forwards the
> page to "/app/ListOfOrder.exe". It is another http request, because the
> path
> attribute specified in <forward> is only "/app/ListOfOrder.exe". Not
> "/app/ListOfOrder.exe?orderNumber=123".
> (You wouldn't know what the orderNumber will be when
> you write struts-config.xml)
> So the action "/app/ListOfOrder.exe" has no idea of "orderNumber".
> 
> A simple way to solve this problem is that
> you can save the "orderNumber" to request scope in "/app/DeleteOrder.exe".
> 
> request.setAttribute("orderNumber", new
> Integer(orderNumber));
> 
> And then retrieve it in "/app/ListOfOrder.exe".
> 
> Integer orderNumber = (Integer) request.getAttribute("orderNumber");
> 
> Regards,
> Vincent
> 
> --- "Au-Yeung, Stella H" <[EMAIL PROTECTED]> 
> > Bascaily what I would like to accomplish is to
> > delete a "part" from an order
> > form and then re-query the database to display the
> > list of parts.
> >  
> > "DeleteOrder.jsp":
> > - is a screen to confirm to delete part "XZY".
> > - it is of type OrderForm
> > - action = "/app/DeleteOrder"
> > - "orderNumber is a hidden field and is equal to
> > "123".  This is the key to
> > re-query the database later.
> > 
> > "OrderSearchAction":
> > - is the Action class to re-query the database with "orderNumber" 
> > after the deletion and re-display the list of parts on the
> > next screen.
> > I have this statement at the beginning of the Action
> > class to retrieve
> > "orderNumber ": 
> > String nbr = request.getParameter("orderNumber");
> > 
> > 
> > Struts-config.xml:
> >    <action    path="/app/DeleteOrder"
> >               
> > type="com.cat.action.OrderMaintainAction"
> >                name="OrderFormBean"
> >               scope="request"
> >            validate="false">
> >         <forward name="Content"
> > path="/app/ListOfOrder.exe" />
> >         <forward name="ContentError" path="/app/DeleteError.jsp"/>
> >     </action>
> > 
> >     <action    path="/app/ListOfOrder"
> >               
> > type="com.cat.action.OrderSearchAction"
> >                name="OrderSearchFormBean"
> >               scope="request"
> >            validate="false">
> >         <forward name="Content"
> > path="/app/ListOfOrder.jsp"/>
> >     <forward name="ContentError"
> > path="/app/OrderError.jsp"/>
> > 
> >     </action>
> > 
> > So when I hit 'submit' on "DeleteOrder.jsp", I
> > expect "orderNumber " to be
> > visible in "OrderSearchAction" in the Request object
> > but it is not.
> > Thanks for any help.   
> > 
> 
> 
> 
> -----------------------------------------------------------------
> 每天都 Yahoo!奇摩
> 海的顏色、風的氣息、愛你的溫度,盡在信紙底圖
> http://tw.promo.yahoo.com/mail_premium/stationery.html
> 
> ---------------------------------------------------------------------
> 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]
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you抮e looking for faster
http://search.yahoo.com

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

Reply via email to