If your redirecting to another action then the request is still holds the
same parameters.
Therefore what you are seeing is completely normal behavior.
You can write a request wrapper that will remove the parameters or you can
change the way you do your redirect.
I don't know how your redirecting so I cant tell you an alternative.
-Tim

-----Original Message-----
From: Alex Winston [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 2:42 PM
To: Struts Users Mailing List
Subject: Re: Forwarding to Action


After consulting the api, and browsing through the list archives again I
was able to discover that in order to instantiate a new instance of a
DynaActionForm to set within the request the following code is required,
which is listed below. Hopefully this will be helpful to someone in the
future with the same problem.  However, after successfully managing to
work my way through this problem, I have run into another problem.  It
appears that when I forward to an action after setting my new
DynaActionForm in the request, the next action overwrites the values,
with values that where passed to the initial request.  The log excerpt
below details the problem.  You will notice that serviceForm is set and
found, and notice that it says that it will be recycled. but immediately
after that it repopulates the bean properties, thus overriding the
values that i set.  Any thoughts, are am I trying to do something that
really isn't possible?

Thanks
Alex

// Initialize the DynaActionFormClass.
ModuleConfig mc =
        (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
FormBeanConfig fbc =
        mc.findFormBeanConfig("serviceForm");
DynaActionFormClass dafc =
        DynaActionFormClass.createDynaActionFormClass(fbc);

// Create a new instance of the serviceForm DynaActionForm.
DynaActionForm serviceForm = (DynaActionForm) dafc.newInstance();
serviceForm.set("id", (String) aspectForm.get("serviceId"));

// Set the serviceForm in the HttpServletRequest.
request.setAttribute("serviceForm", serviceForm);


2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  - Processing a 'GET' for path
'/editService'
2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.util.RequestUtils  -  Looking for ActionForm bean
instance in scope 'request' under attribute key 'serviceForm'
2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.util.RequestUtils  -  Recycling existing
DynaActionForm instance of type 'serviceForm'
2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.util.RequestUtils  -  -->
DynaActionForm[dynaClass=serviceForm,type=,description=,name=,id=1830746640-
92]
2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  -  Storing ActionForm bean
instance in scope 'request' under attribute key 'serviceForm'
2003-05-30 14:15:28,786 [Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  -  Populating bean properties
from this request
2003-05-30 14:15:28,787 [Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  -  Looking for Action
instance for class
com.christianity.dashboard.struts.action.manager.EditService
2003-05-30 14:15:28,787 [Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  -   Returning existing Action
instance


On Thu, 2003-05-29 at 19:13, Michael Ruppin wrote:
> Request variables are not lost unless you set
> redirect=true in your [editService] mapping, or
> construct an ActionForward from scratch, setting
> redirect=true.
> 
> --- Alex Winston <[EMAIL PROTECTED]> wrote:
> > My apologizes for yet another thread on action
> > chaining, but I am in a
> > bit of a pickle, and the archives have been of
> > little help.
> > 
> > I have the following struts configuration, modified
> > for brevity.
> > 
> > <form-bean name="serviceForm"
> >             type="org.apache.struts.action.DynaActionForm">
> >     <form-property name="id" type="java.lang.String"/>
> >     <form-property name="name"
> > type="java.lang.String"/>
> >     <form-property name="type"
> > type="java.lang.String"/>
> >     <form-property name="description"
> > type="java.lang.String"/>
> > </form-bean>
> > 
> > <action path="/editService"
> >     
> >
> type="com.christianity.dashboard.struts.action.manager.EditService"
> >             name="serviceForm"
> >             scope="request"
> >             validate="false">
> >     <forward name="view" path="/jsp/editService.jsp"/>
> > </action>
> > 
> > <action path="/createAspect"
> >     
> >
> type="com.christianity.dashboard.struts.action.manager.CreateAspect"
> >             name="aspectForm"
> >             scope="request"
> >             validate="false">
> >     <forward name="view" path="/editService.do"/>
> > </action>
> > 
> > 
> > The problem occurs when I forward from createAspect
> > to editService after
> > setting request variables. I am setting attributes
> > of the serviceForm in
> > the request within createAspects execute method, but
> > unfortunately no
> > values are set when editService checks the
> > serviceForm DynaActionForm
> > within its execute method.  Am I incorrect in
> > assuming that this is
> > possible, and if not what am I missing?  Are request
> > variables lost when
> > forwarding to another action?
> > 
> > Thanks
> > Alex
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Alex Winston <[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]

Reply via email to