SpringWebFlow+;门户-如何在流定义中获取url参数?
我对门户网站和SpringWebFlow有点陌生,并尝试将它们结合起来,以便为各种用户任务设置流。我的问题是,我需要生成指向第一个状态的直接URL,并将子流的名称作为参数传递,以便从那里开始执行正确的子流-我不知道如何获取该参数 这是我的上下文配置SpringWebFlow+;门户-如何在流定义中获取url参数?,url,parameters,portal,spring-webflow,Url,Parameters,Portal,Spring Webflow,我对门户网站和SpringWebFlow有点陌生,并尝试将它们结合起来,以便为各种用户任务设置流。我的问题是,我需要生成指向第一个状态的直接URL,并将子流的名称作为参数传递,以便从那里开始执行正确的子流-我不知道如何获取该参数 这是我的上下文配置 <!-- Maps portlet modes to handlers --> <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.
<!-- Maps portlet modes to handlers -->
<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
<property name="portletModeMap">
<map>
<entry key="view">
<bean class="com.mycompany.login.portlet.ViewFlowHandler" />
</entry>
</map>
</property>
</bean>
<!-- Enables FlowHandlers -->
<bean class="org.springframework.webflow.mvc.portlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<!-- Executes flows: the central entry point into the Spring Web Flow system -->
<webflow:flow-executor id="flowExecutor">
</webflow:flow-executor>
<!-- The registry of executable flow definitions -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderService">
<webflow:flow-location path="classpath:flows/login-flow.xml" />
<webflow:flow-location path="classpath:flows/main-flow.xml" />
<webflow:flow-location path="classpath:flows/pwd-recovery-flow.xml" />
</webflow:flow-registry>
<webflow:flow-builder-services id="flowBuilderService" view-factory-creator="viewFactoryCreator"/>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref bean="viewResolver"/>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/flow-views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- beans for business logic -->
<bean id="authService"
class="com.mycompany.login.portlet.service.AuthService"
scope="prototype" />
<!-- constants -->
<bean id="flowNames" class="com.mycompany.login.portlet.Flows" scope="singleton">
<property name="loginMain"><value></value></property>
<property name="passwordRecover"><value>pwd-recovery</value></property>
<property name="finish"><value>finish</value></property>
<property name="nflow"><value></value></property>
</bean>
入口点是主流,它基于url中名为“flo”的get参数重定向到子流。当前,当我尝试直接访问此文件时,我的requestParameter映射为空。我不知道在这种情况下url是什么。当前URL的一个示例是“http://localhost:8080/portal/portal/default/Login/Mycompany+LoginWindow?flo=pwd恢复”。稍后我还想在URL中传递其他参数,如userid等,但我现在得到了requestParameters的空白映射。这是我的入口点流定义
main-flow.xml
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd“>
我认为您的问题与Spring Webflow无关,而与Portlet有关。请查看:
这显示了从portlet获取请求参数的一种方法。但是我不知道如何从Spring webflow中执行此操作-尽管我正在尝试找出!!!您使用了错误的标记。SWF代表ShockWave Flash。我修复了它。
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";
}
}
<action-state id="branch">
<on-entry>
<!-- <evaluate expression="flowNames.setNflow(requestParameters.flo)"/> -->
<evaluate expression="flowNames.checking(requestParameters)"/>
</on-entry>
<evaluate expression="flowNames.enableTransition()" />
<transition on="yes" to="proceed" />
</action-state>
<action-state id="proceed">
<!--<if test="flowNames.nflow==''" then="login"/>
<if test="flowNames.nflow=='pwd-recovery'" then="pwd-recovery"/>
<if test="flowNames.nflow=='finish'" then="finish-main"/>-->
<on-entry>
<!-- <evaluate expression="flowNames.setNflow(requestParameters.flo)"/> -->
<evaluate expression="flowNames.checking(requestParameters)"/>
</on-entry>
<evaluate expression="flowNames.nflow"/>
<transition on="pwd-recovery" to="pwd-recovery"/>
<transition on="finish" to="finish-main"/>
<transition to="login"/>
</action-state>
<subflow-state id="login" subflow="login-flow">
<transition on="finish-login" to="proceed"/>
</subflow-state>
<subflow-state id="pwd-recovery" subflow="pwd-recovery-flow">
<transition on="finish-pwd" to="proceed"/>
</subflow-state>
<end-state id="finish-main"/>