Spring web flow dynamic url

I'm learning to use Spring Webflow. I've already have a working flow, where i created an old school installer where a user creates a configuration object. This is working as intended. Now, what i want to do is to make possible to edit a configuration object. For this i would need to pass this flow the selected configuration object. I thought the best way to do is to pass an id to the webflow and with a help of a service set it as a flow variable. My question is how can i create this url mapping.

This is the current url mapping for this flow:

 <bean id="flowMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>/configuration=configController</value>
        </property>
    </bean>

is it possible to do something like this:

<bean id="flowMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>/{id}/configuration=configController</value>
        </property>
    </bean>

Any help is greatly appreciated.


Okay i have the solution.

I wrote it here in case someone has a similar problem in the future.

So i did not need any of the above configuration, since in the flow config xml it is possible to define an input . So example you want to query a configurationId then you can do by the following:

Lets assume that you have the following flow url: http://localhost/flow .

Then you can pass a parameter to the flow.xml like this: http://localhost/flow?configurationId=1 . To pass it you have to define an input in the flow configuration like this: <input name="configurationId"/> .

And there is your id you can create a service for this to return a concrete object.

链接地址: http://www.djcxy.com/p/6662.html

上一篇: Spring Web Flow中的动态强制转换

下一篇: Spring Web流动态网址