4

まず、Spring Webflow の安静な URL リクエストを構成する方法がわかりません。たとえば、アドレスを入力したときに Webflow を呼び出す方法がわかりません :

これを処理するSpring mvcコントローラーを書くのは簡単ですが、webflowの場合、パラメーターを渡す方法がわかりません。

誰でも私を助けることができますか?ありがとう

4

2 に答える 2

3

Try reading request parameter like following. It processes "http://example.com/message?messageId=3" but when rendering view, the URL changes to something like "http://example.com/message?execution=e1s1".

Flow code:

<?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
        http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

    <on-start>
        <evaluate expression="FooWebFlowController.create(flowRequestContext)"
                  result="flowScope.fooModel"/>
    </on-start>

    <view-state id="view" model="fooModel" view="fooView">
    </view-state>
</flow>

FooWebFlowController bean:

import org.springframework.webflow.execution.RequestContext;

@Component
public class FooWebFlowController {

    @Autowired
    private FooDAO fooDAO;

    public Foo create(RequestContext requestContext) {
        String messageId = requestContext.getRequestParameters().get("messageId")
        Foo foo = fooDAO.findByMessagId(messageId);
        return foo;
    }
}
于 2011-01-14T07:09:27.550 に答える
0

RequestPathFlowExecutorArgumentHandlerは探しているものですか?

リクエスト パスから引数を抽出し、それらを URL パスで公開する Flow Executor 引数ハンドラー。

これにより、REST スタイルの URL が一般的な形式でフローを開始できるようになります: http://${host}/${context path}/${dispatcher path}/${flowId}

<bean id="flowController" class="org.springframework.webflow.executor.mvc.FlowController">
    <property name="flowExecutor" ref="flowExecutor" />
    <property name="argumentHandler">
        <bean class="org.springframework.webflow.executor.support.RequestPathFlowExecutorArgumentHandler" />
    </property>
</bean>
于 2010-09-21T10:20:36.390 に答える