Hello everyone,
I'm writing to ask for help as I'm trying to create a portlet that can run different flows during its execution, by using the "handler mapping" (class PortletModeParameterHandlerMapping) mechanism.
I''m using Spring 3.0.4.RELEASE, Web Flow 2.2.0, and Liferay as the portlet container.
I've set up the XML configuration files as described in the Web Flow and Spring Portlet documentation (see the relevant sections at the end of this post), implemented 2 different FlowHandlers (each returning a different flow id), and wrote a simple jsp page with 2 anchor links which would switch the flow in the portlet.
It doesn't work: even if I click the link and the new URL shown in the browser has the handler mapping parameter set to the correct key, the view rendered remains the same (and in the debugger I can see the the FlowHandler for the desired key is not invoked - that is, the flow has remained the original, default one).
Note that the WebFlow part is working ok: from the default flow I can easily trigger a subflow call and switch to one of the other flow I defined. It's just that I'd like to have different flows instead of having one single flow which calls the other ones as subflow (I feel it cleaner).
I paste the relevant part of the files, can anyone tell me where I'm wrong or if what I'm trying to do is not supported?
Sorry if the question is stupid and the answer is obvious, but it's my first time at Spring, WebFlow and Portlets...
Many thanks to who's willing to help.
Regards,
Gabriele
Configs:
Code:<webflow:flow-executor id="flowExecutor"> <webflow:flow-execution-attributes> <!-- execution redirects don't apply in a Portlet environment --> <webflow:always-redirect-on-pause value="false"/> </webflow:flow-execution-attributes> </webflow:flow-executor> <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows"> <webflow:flow-location-pattern value="/**/*-flow.xml" /> <webflow:flow-location id="base" path="base-flow.xml"></webflow:flow-location> </webflow:flow-registry> <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator" /> <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> </bean>
JSP Code:Code:<bean id="flussoFlowHandler" class="it.insiel.sktrdomande.web.flows.FlussoFlowHandler"/> <bean id="ricercaFlowHandler" class="it.insiel.sktrdomande.web.flows.RicercaFlowHandler"/> <bean id="parameterMappingInterceptor" class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"> <property name="parameterName" value="menuChoice"></property> </bean> <bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping" > <property name="defaultHandler" value="homeFlowHandler"></property> <property name="parameterName" value="menuChoice"></property> <property name="portletModeParameterMap"> <map> <entry key="view"> <map> <entry key="search" value-ref="searchFlowHandler"></entry> <entry key="home" value-ref="homeFlowHandler"></entry> </map> </entry> </map> </property> <property name="interceptors"> <list> <ref bean="parameterMappingInterceptor"/> </list> </property> </bean> <bean id="flowHandlerAdapter" class="org.springframework.webflow.mvc.portlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor"></property> </bean>
FlowHandlers:Code:<a href='<portlet:renderURL><portlet:param name="menuChoice" value="search"/></portlet:renderURL>'>Search</a> <a href='<portlet:renderURL><portlet:param name="menuChoice" value="home"/></portlet:renderURL>'>Home</a>
Code:package it.insiel.sktrdomande.web.flows; import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; public class HomeFlowHandler extends AbstractFlowHandler { @Override public String getFlowId() { return "home"; } }Code:package it.insiel.sktrdomande.web.flows; import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; public class SearchFlowHandler extends AbstractFlowHandler { @Override public String getFlowId() { return "search"; } }


Reply With Quote
