Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring webflow + portal - How do you get url parameters in the flow definition?
    primarykey
    data
    text
    <p>I am kinda new to the portals and spring webflow and trying to combine them for the purpose of setting flows for various user tasks. My problem is that I need to generate a direct URL to the first state and pass in the name of the subflow as a parameter so the right subflow is executed from there onwards - I don't know how to get that parameter.</p> <p>Here is my context config</p> <pre><code>&lt;!-- Maps portlet modes to handlers --&gt; &lt;bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping"&gt; &lt;property name="portletModeMap"&gt; &lt;map&gt; &lt;entry key="view"&gt; &lt;bean class="com.mycompany.login.portlet.ViewFlowHandler" /&gt; &lt;/entry&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!-- Enables FlowHandlers --&gt; &lt;bean class="org.springframework.webflow.mvc.portlet.FlowHandlerAdapter"&gt; &lt;property name="flowExecutor" ref="flowExecutor"/&gt; &lt;/bean&gt; &lt;!-- Executes flows: the central entry point into the Spring Web Flow system --&gt; &lt;webflow:flow-executor id="flowExecutor"&gt; &lt;/webflow:flow-executor&gt; &lt;!-- The registry of executable flow definitions --&gt; &lt;webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderService"&gt; &lt;webflow:flow-location path="classpath:flows/login-flow.xml" /&gt; &lt;webflow:flow-location path="classpath:flows/main-flow.xml" /&gt; &lt;webflow:flow-location path="classpath:flows/pwd-recovery-flow.xml" /&gt; &lt;/webflow:flow-registry&gt; &lt;webflow:flow-builder-services id="flowBuilderService" view-factory-creator="viewFactoryCreator"/&gt; &lt;bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"&gt; &lt;property name="viewResolvers"&gt; &lt;list&gt; &lt;ref bean="viewResolver"/&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt; &lt;property name="prefix" value="/WEB-INF/flow-views/"/&gt; &lt;property name="suffix" value=".jsp"/&gt; &lt;/bean&gt; &lt;!-- beans for business logic --&gt; &lt;bean id="authService" class="com.mycompany.login.portlet.service.AuthService" scope="prototype" /&gt; &lt;!-- constants --&gt; &lt;bean id="flowNames" class="com.mycompany.login.portlet.Flows" scope="singleton"&gt; &lt;property name="loginMain"&gt;&lt;value&gt;&lt;/value&gt;&lt;/property&gt; &lt;property name="passwordRecover"&gt;&lt;value&gt;pwd-recovery&lt;/value&gt;&lt;/property&gt; &lt;property name="finish"&gt;&lt;value&gt;finish&lt;/value&gt;&lt;/property&gt; &lt;property name="nflow"&gt;&lt;value&gt;&lt;/value&gt;&lt;/property&gt; &lt;/bean&gt; </code></pre> <p></p> <p>My flow handler:</p> <pre><code>package com.mycompany.login.portlet; import javax.servlet.http.HttpServletRequest; import org.springframework.webflow.core.collection.LocalAttributeMap; import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; public class ViewFlowHandler extends AbstractFlowHandler{ public String getFlowId() { return "main-flow"; } } </code></pre> <p>And the point of entry is the main-flow which based on the get parameter in the url called "flo" will redirect to a sub-flow. Currently when I try to access this directly, my requestParameter map is blank. I don't know what the url would be in this case. An example of the current URL is "http://localhost:8080/portal/portal/default/Login/Mycompany+LoginWindow?flo=pwd-recovery". Also later on I want to pass in additional parameters in the URL such as userid etc. but I'm getting a blank map for requestParameters right now. Here is my entry point flow definition</p> <p>main-flow.xml</p> <p></p> <p>http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"></p> <pre><code>&lt;action-state id="branch"&gt; &lt;on-entry&gt; &lt;!-- &lt;evaluate expression="flowNames.setNflow(requestParameters.flo)"/&gt; --&gt; &lt;evaluate expression="flowNames.checking(requestParameters)"/&gt; &lt;/on-entry&gt; &lt;evaluate expression="flowNames.enableTransition()" /&gt; &lt;transition on="yes" to="proceed" /&gt; &lt;/action-state&gt; &lt;action-state id="proceed"&gt; &lt;!--&lt;if test="flowNames.nflow==''" then="login"/&gt; &lt;if test="flowNames.nflow=='pwd-recovery'" then="pwd-recovery"/&gt; &lt;if test="flowNames.nflow=='finish'" then="finish-main"/&gt;--&gt; &lt;on-entry&gt; &lt;!-- &lt;evaluate expression="flowNames.setNflow(requestParameters.flo)"/&gt; --&gt; &lt;evaluate expression="flowNames.checking(requestParameters)"/&gt; &lt;/on-entry&gt; &lt;evaluate expression="flowNames.nflow"/&gt; &lt;transition on="pwd-recovery" to="pwd-recovery"/&gt; &lt;transition on="finish" to="finish-main"/&gt; &lt;transition to="login"/&gt; &lt;/action-state&gt; &lt;subflow-state id="login" subflow="login-flow"&gt; &lt;transition on="finish-login" to="proceed"/&gt; &lt;/subflow-state&gt; &lt;subflow-state id="pwd-recovery" subflow="pwd-recovery-flow"&gt; &lt;transition on="finish-pwd" to="proceed"/&gt; &lt;/subflow-state&gt; &lt;end-state id="finish-main"/&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload