Announcement Announcement Module
Collapse
No announcement yet.
Portlet mode navigation trouble Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Portlet mode navigation trouble

    Hey!
    I'm having trouble to display the correct view when I navigate between view mode and config mode.

    This is the scenario:

    1. Entering my portlet and my TipFormController displays the formView in the view mode (inheriting SimpleFormController)

    2. I enter the config mode and my PortletConfigFormController displays it's formView (also inheriting SimpleFormView)

    3. I fill in the portlet configuration form and post it, the PortletConfigFormController sends me to it's successView, which is a simple jsp that tells me everything went well.

    4. Right after I return to the view mode and then the TipFormController successView is displayed. WHY?

    How do I manage the portlet to display the TipFormController formView when I return from the config mode??

    This doesn't happen if I go from the config mode formView to view mode.
    If I do that the TipFormController display it's formView.

    When I submit, my controllers override onSubmitAction method to manage the submits and I let spring handle the displaying of the successView.

    Here is my context configuration..
    Code:
        <bean id="tipFormController" class="com.acandofrontec.portal.tipbox.portlet.controller.TipFormController">
    		<property name="sessionForm" value="true"/>
    		<property name="commandName" value="tip"/>
    		<property name="commandClass" value="com.acandofrontec.portal.tipbox.model.Tip"/>
    		<property name="formView" value="tipForm"/>
    		<property name="successView" value="tipView"/>
    		<property name="validator" ref="tipValidator"/>
    		<property name="tipService" ref="tipService"/>	
        </bean>
    
    	<bean id="tipViewController" class="com.acandofrontec.portal.tipbox.portlet.controller.TipViewController">
    		<property name="displayView" value="tipView"/>
    		<property name="tipService" ref="tipService"/>
    	</bean>
    	
        <bean id="portletConfigFormController" class="com.acandofrontec.portal.tipbox.portlet.controller.PortletConfigFormController">
    		<property name="sessionForm" value="false"/>
    		<property name="commandName" value="portletConfig"/>
    		<property name="commandClass" value="com.acandofrontec.portal.tipbox.portlet.controller.PortletConfigCommand"/>
    		<property name="formView" value="portletConfigForm"/>
    		<property name="successView" value="message"/>
        </bean>
    	
    	
    	<!-- Handler Mapping -->
    	
    	<bean id="parameterMappingInterceptor" class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"/>
    
    	<!--
    		Here is the place where you map parameters to controller classes.
    		If you in your "view" controller asks for "addTip" this mapping will route you
    		to tipFormController.
    	-->
    	<bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
            <property name="order" value="10"/>
    		<property name="interceptors">
    			<list>
    				<ref bean="parameterMappingInterceptor"/>
    			</list>
    		</property>
    		<property name="portletModeParameterMap">
    			<map>
    				<entry key="view">
    					<map>
    						<entry key="addTip"><ref bean="tipFormController"/></entry>
    						<entry key="viewTip"><ref bean="tipViewController"/></entry>
    					</map>
    				</entry>
    				<entry key="config">
    					<map>
    						<entry key="configPortlet"><ref bean="portletConfigFormController"/></entry>
    					</map>
    				</entry>
    			</map>
    		</property>
    	</bean>
    
    	<!--
    		Here is the place where you map the controllers that you want to be
    		executed when user enter a new portlet mode
    	-->
    	<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
            <property name="order" value="20"/>
    		<property name="portletModeMap">
    			<map>
    				<entry key="view"><ref bean="tipFormController"/></entry>
    				<entry key="config"><ref bean="portletConfigFormController"/></entry>
    			</map>
    		</property>
    	</bean>
    Last edited by montana; Nov 18th, 2005, 03:36 PM.

  • #2
    Sorry for the slow reponse -- I have been remiss in responding to forum questions.

    This is one of the most annoying side-effects of the JSR-168 spec making it almost impossible to communicate effectively between the action phase and the render phase of the request.

    The reason this is happening is because one of your AbstractFormController based classes will set a render Parameter to indicate that the form was submitted. Then when you change mode, the render parameters are preserved, but you are mapped to a different Controller that is still fed that same render parameter and thinks a form was just submitted.

    The workaround for this is to override the 'getFormSubmitParameterName' method in your EDIT mode controller to use a different parameter name from the Controllers that are in your VIEW mode.

    Comment

    Working...
    X