I have a question about ParameterInterceptor. Is it expected behaviour to limit the parameters that are to be chained from one action to another to those in the HTTP request and to not allow updates to the parameter values outside of the HTTP request, say, from an action prior to a chain?
The investigation layed out below started when the getId/setId methods in an action were not called during a chain. webwork and xwork jars were updated from CVS 2003-12-02 (beta2). I have a form used to create a new entity that calls DatabaseAdminAction.doCreate(): <action name="databaseCreate" class="com.hp.sdfp.tracedata.webwork.DatabaseAdminAction" method="doCreate" > <result name="exit" type="chain"> <param name="actionName">databasesAdmin</param> </result> <result name="input" type="dispatcher"> <param name="location">/templates/adminDatabaseCreate.vm</param> </result> <result name="success" type="chain"> <param name="actionName">databaseEdit</param> </result> <interceptor-ref name="authStack"/> </action> authStack interceptor is defaultStack + authentication. Upon entity creation, after a database write, this.setId() is called (with new entity database id), SUCCESS is returned and control is chained to DatabaseAdminAction.doEdit() as expected: <action name="databaseEdit" class="com.hp.sdfp.tracedata.webwork.DatabaseAdminAction" method="doEdit" > <result name="exit" type="chain"> <param name="actionName">databasesAdmin</param> </result> <result name="input" type="dispatcher"> <param name="location">/templates/adminDatabaseEdit.vm</param> </result> <interceptor-ref name="authStack"/> </action> HERE IS THE TROUBLING PART. doEdit() fails and exits, because the "id" property isn't set. Here are the methods in DatabaseAdminAction that would like to participate: private String _id = null; public String getId() { return( _id ); } public void setId( String id ) { _id = id; } The log shows that all other local "properties" are passed, except for "id" (3rd from last line): [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.ActionChainResult DEBUG - Chaining to action databaseEdit [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.DefaultActionProxy DEBUG - Creating an DefaultActionProxy for namespace and action name databaseEdit [2003-12-02 16:07:30,890] Thread-3 org.springframework.beans.factory.xml.XmlBeanFactory DEBUG - Returning cached instance of singleton bean 'components' [2003-12-02 16:07:30,890] Thread-3 com.hp.sdfp.tracedata.interceptors.AuthorizationInterceptor INFO - AUTH: app.security is off [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.interceptor.LoggingInterceptor INFO - Starting execution stack for action databaseEdit [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.interceptor.StaticParametersInterceptor DEBUG - Setting static parameters {} [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.interceptor.ParametersInterceptor DEBUG - Setting params {active=[Ljava.lang.String;@170984c, doUpdate=[Ljava.lang.String;@11ed166, referenceUrl=[Ljava.lang.String;@45aa2c, commentUrl=[Ljava.lang.String;@1a734ff, name=[Ljava.lang.String;@886ad0} [2003-12-02 16:07:30,890] Thread-3 com.opensymphony.xwork.DefaultActionInvocation INFO - Executing action method = doEdit [2003-12-02 16:07:30,890] Thread-3 com.hp.sdfp.tracedata.webwork.DatabaseAdminAction DEBUG - DatabaseAdminAction.doEdit() I also suspect action errors are not chained either, as they aren't showing up in the view, but I haven't looked at that yet. ATTEMPTED WORKAROUNDS: Changed getId() to getChainId() and setId() to setChainId(). No change. No additional get/set methods are chained, regardless of name. I notice that com.opensymphony.xwork.interceptor.ParametersInterceptor.before() calls ActionContext.getContext().getParameters(). If the comments for getParameters() can be believed, the action is not consulted to determine chained parameters: /** * Returns a Map of the HttpServletRequest parameters when in a servlet * environment or a generic Map of parameters otherwise. * * @return Map of HttpServletRequest parameters, generic Map of parameters or * multipart Map. */ public Map getParameters() { return (Map) get(PARAMETERS); } Tried to include the parameter manually in doCreate(): java.util.Map params = ActionContext.getContext().getParameters(); params.put( "id", getId() ) ActionContext.getContext().setParameters( params ); but that isn't allowed: java.lang.IllegalStateException: Cannot find message associated with key 'parameterMap.locked' Changed create URL to include a dummy "id" value: "databaseCreate.action?id=666" This, and a hidden form variable, cause the "id" variable to be chained successfully. However, the value that is chained is the ORIGINAL PARAMETER VALUE! (Not totally unexpected after seeing how ActionContext is used). The log shows the original id value (666) was injected into the new action instead of the new value(21) (see last line): [2003-12-02 17:18:27,593] Thread-2 com.hp.sdfp.tracedata.webwork.DatabaseAdminAction DEBUG - setId(21) [2003-12-02 17:18:27,593] Thread-2 com.hp.sdfp.tracedata.webwork.DatabaseAdminAction DEBUG - 6.1.2 action id = 21 [2003-12-02 17:18:27,593] Thread-2 com.opensymphony.xwork.ActionChainResult DEBUG - Chaining to action databaseEdit [2003-12-02 17:18:27,593] Thread-2 com.opensymphony.xwork.DefaultActionProxy DEBUG - Creating an DefaultActionProxy for namespace and action name databaseEdit [2003-12-02 17:18:27,593] Thread-2 org.springframework.beans.factory.xml.XmlBeanFactory DEBUG - Returning cached instance of singleton bean 'components' [2003-12-02 17:18:27,593] Thread-2 com.hp.sdfp.tracedata.interceptors.AuthorizationInterceptor INFO - AUTH: app.security is off [2003-12-02 17:18:27,593] Thread-2 com.opensymphony.xwork.interceptor.LoggingInterceptor INFO - Starting execution stack for action databaseEdit [2003-12-02 17:18:27,593] Thread-2 com.opensymphony.xwork.interceptor.StaticParametersInterceptor DEBUG - Setting static parameters {} [2003-12-02 17:18:27,593] Thread-2 com.opensymphony.xwork.interceptor.ParametersInterceptor DEBUG - Setting params {active=[Ljava.lang.String;@9dca26, doUpdate=[Ljava.lang.String;@1429cb2, referenceUrl=[Ljava.lang.String;@3da850, commentUrl=[Ljava.lang.String;@1f51e5c, name=[Ljava.lang.String;@19c6163, id=[Ljava.lang.String;@1bdbfec} [2003-12-02 17:18:27,609] Thread-2 com.hp.sdfp.tracedata.webwork.DatabaseAdminAction DEBUG - setId(666) QUESTION: Is this the desired behaviour? Webwork1 seems to handle this as expected by passing and Java bean type parameters. How can the parameter value be updated for a chain in xwork? PS: Using ActionContext.getContext().getSession().put( "createId", getId() ); in doCreate() and: setId( ( String )ActionContext.getContext().getSession().get( "createId" ) ); in doEdit() gets me by for now. Thank for your assistance. __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork