Getting an request parameter via AbstractXsltView.getParameters(HttpServletRequest) is always null.
eg url.
data-maintenance.htm?_flowId=create-user&_type=User
Is anyone else having problems like this?
Spring 1.2.7, SWF1.0
Getting an request parameter via AbstractXsltView.getParameters(HttpServletRequest) is always null.
eg url.
data-maintenance.htm?_flowId=create-user&_type=User
Is anyone else having problems like this?
Spring 1.2.7, SWF1.0
Could you provide a bit more info on your situation:
Are you triggering the XSLT view in a normal view state?
Are you using alwaysRedirectOnPause?
What exactly are you trying to do?
...
Erwin
Hi Erwin,
Yes.Are you triggering the XSLT view in a normal view state?
NoAre you using alwaysRedirectOnPause?
I am trying to get the request parameters from the URL which is modelled below:What exactly are you trying to do?
The code defines a submenu action named 'Users', which has a URL command that declares the flow id and some additional variables '_rc' and '_search'.
The req parametes are in the 'context.getRequestParameters().toString()' map when I enter the flow (setupForm) and after I exit doPostExecute, but they are lost when in my View extending AbstractXsltView:Code:<Action name="showUsersCategory"> <Property name="display">Users</Property> <Property name="command">data-maintenance.htm?_flowId=view-report&_rc=Users&_search=no</Property> </Action>
At this point I only have the FlowExecutionKey.
This previously worked in RC3..unfortunately the codebase isn't full of junit tests so without rolling back I cannot be sure of which version upgrade (either RC4 or 1.0) may of broke this functionality.Code:protected Map getParameters(HttpServletRequest request) { Map params = super.getParameters(request); System.out.println("req params: " + request.getParameterMap().toString());
James
Last edited by jamesclinton; Nov 14th, 2006 at 04:12 AM.
My guess is that you are using "alwaysRedirectOnPause". It is the default in SWF 1.0 so unless you explicitly set it to false you'll be getting POST-REDIRECT-GET behaviour.
This explains the behaviour you see: During the first POST request you have the request parameters you want. The view state will not directly render the view, instead it will issue a redirect which will cause a second GET request that refreshes the flow execution. This GET refreshes the flow and renders the view. It also only has a single request parameter: the flow execution key.
To turn off alwaysRedirectOnPause, specify it in your FlowExecutor config:
ErwinCode:<flow:executor id="flowExecutor" registry-ref="flowRegistry"> <flow:execution-attributes> <flow:alwaysRedirectOnPause value="false"/> </flow:execution-attributes> </flow:executor>
Erwin
Currently I'm still on Spring 1.2.7 for the next few weeks..could you kindly share the configuration based on DOCTYPE not XSD.
Thank you.Code:<!-- Launches new flow executions and resumes existing executions Spring 1.2 configuration--> <bean id="flowExecutor" class="org.springframework.webflow.config.FlowExecutorFactoryBean"> <property name="definitionLocator" ref="flowRegistry"/> <property name="alwaysRedirectOnPause" value="false"/> ??? </bean> <!-- Creates the registry of flow definitions for this application Spring 1.2 configuration --> <bean id="flowRegistry" class="org.springframework.webflow.engine.builder.xml.XmlFlowRegistryFactoryBean"> <property name="flowLocations" value="/WEB-INF/flow/*.xml"/> </bean>
Here it is:
ErwinCode:<bean id="flowExecutor" class="org.springframework.webflow.config.FlowExecutorFactoryBean"> <property name="definitionLocator" ref="flowRegistry"/> <property name="executionAttributes"> <map> <entry key="alwaysRedirectOnPause" value="false"/> </map> </property> </bean>
Great. Many thanks Erwin.
Or rather, you'll need:
Since it needs to be a boolean.Code:<entry key="alwaysRedirectOnPause"> <value type="java.lang.Boolean">false</value> </entry>
Erwin
Erwin
Unfortunately this configuration throws an exception:
JamesCode:IllegalArgumentException: Map key 'alwaysRedirectOnPause' has value [false] that is not of expected type [class java.lang.Boolean], instead it is of type [java.lang.String]
Check my previous post
This will be improved in SWF 1.0.1, where it will also accept the String values "true" or "false".
Erwin
Last edited by klr8; Nov 14th, 2006 at 06:36 AM.