Aug 22nd, 2008, 08:53 AM
PortelMode Parameter Mapping View Question
I have question regarding Spring MVC portlet development. If my portlet has multiple view controllers and I am using the PortletModeParameterHandlerMapping class, how do I set my portlet to specify a
specific view as the initial view? I see a lot of examples that only have one view and use the other views with the portletrender url action parameter to map them to that. Does the order value have any significance?
For example where would i put the parameter for the first view entry <entry key="books"><ref bean="booksController"/></entry>?
<bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.Por tletModeParameterHandlerMapping">
<property name="order" value="10"/>
<entry key="books"><ref bean="booksController"/></entry>
<entry key="incrementBook"><ref bean="bookIncrementController"/></entry>
<entry key="viewBook"><ref bean="bookViewController"/></entry>
<entry key="editBook"><ref bean="bookEditController"/></entry>
<entry key="deleteBook"><ref bean="bookDeleteController"/></entry>
<entry key="addBook"><ref bean="bookAddController"/></entry>
Last edited by Howler72; Aug 22nd, 2008 at 09:07 AM.
Aug 22nd, 2008, 09:33 AM
I found this old blurb that answered my question.
"Take another look at spring-portlet-sample/WEB-INF/context/portlet/books.xml in the sample application. In there, you will see that there are two HandlerMappings: 'portletModeParameterHandlerMapping' with an 'order' value of 10 and 'portletModeHandlerMapping' with an 'order' value of 20. So what happens is that the request is run through the mappings according to the 'order' property. If there is no matching entry in the first mapping, it moves to the second one, and so on. In the case of a request where no 'action' parameter value has been set, the first mapping will not match since all the entries specify an 'action' parameter value. It will then go on to the second mapping which essentially declares the default mapping for each possible portlet mode."