In short you have jspA....
<form name="myForm" action="/myAction.do"> <input type="hidden" name="myRequestVal" value="123"> <input type="submit"> </form> or.... <a href="/myAction.do?myRequestVal=123">Continue to jsp B</a> now you create an action: public class MyAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String myValue = request.getParameter("myRequestVal"); request.setAttribute("myRequestVal", myValue); return mapping.findForward("success"); } } Create the following mappings in your struts-config.xml <action path="/myAction" type="mypackage.MyAction" scope="request"> <forward name="success" path="/jspB.jsp" /> </action> of course myRequestVal is the attribute you want to see in jspB. Al -----Original Message----- From: Daniel PC Leung [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 10:22 AM To: Struts Users Mailing List Subject: Re: How to set attribute in ForwardAction? Where should I put the following codings? Should I extend the class of ForwardAction? Public ActionMapping execute(.....) { String myValue = request.getParameter("myRequestVal"); Request.setAttribute("myRequestVal", myValue); Return mapping.findForward("success"); } On Apr 7, 2005 11:21 PM, Fogleson, Allen <[EMAIL PROTECTED]> wrote: > You don't need a form but you will have to create your own action... > something like this execute method in it will do the trick: > > <jsp A> > <input type="hidden" name="myRequestVal" value="123"> > > Action Execute method > > Public ActionMapping execute(.....) { > > String myValue = request.getParameter("myRequestVal"); > Request.setAttribute("myRequestVal", myValue); > Return mapping.findForward("success"); > } > > <jsp B> > > I got <%= request.getAttribute("myRequestVal") %> > > o.a.s.a.ForwardAction is really designed to be used when you don't have > to perform any logic, and to keep you away from linking directly to a > jsp. > > Al > > > -----Original Message----- > From: Daniel PC Leung [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 07, 2005 10:13 AM > To: Struts Users Mailing List > Subject: How to set attribute in ForwardAction? > > I make use ForwardAction to go from page A to page B, just clicking a > link. > > e.g. > <action path="/userAccountMaintPath" > type="org.apache.struts.actions.ForwardAction" > parameter="user.userAccountMaint"/> > > There are no form in between. > How can I set an attribute in page A so that I can get the attribute > back in page B? > > Thank you very much! > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]