|
From: Nick L. <nl...@es...> - 2004-08-17 23:27:13
|
> Nick Lothian wrote: > > > If I have a link to a portlet action that also changes the > view mode, then > > the view mode will be changed before the handleRequest > method is called. > > This means the handleRequest won't be called on the > controller I would > > expect. > > > > EG: > > I have two PortletController's - one for edit mode and one > for view mode. In > > the JSP for the edit mode I have a link to: > > > > <portlet:actionURL portletMode="view" /> > > > > When I execute that link, I was expecting the handleRequest > method in my > > edit portlet controller to be called (since I'm in edit mode and I'm > > executing an action). > > > > What happens is that the mode change is processed first > (ie, the portlet > > changes to view mode) and then the handleRequest method in > my view portlet > > controller is executed. > > > > Is this a deliberate design decision? If not is it possible > to implement it > > differently - or am in the minority about finding that confusing? > > > > We should probably follow whatever the spec says with regards to the > portlet tab lib. Is this behavior inconsisent with the spec? > When you use a portlet actionURL tag it will invoke the processAction method on javax.portlet.GenericPortlet It's difficult to say if this is inconsistant with what Spring does, since there is no concept of different classes handling different portlet modes. > Mapping from PortletMode to Controller might also not be the best > choice. It was the simplest thing I could do to get the prototype > working. We probably need something like a PortletSession or Request > parameter for Controller mappings since the URL is not available. > > I think mapping between a PortletMode and a Controller works quite well. Perhaps we could split the controller interface up into "ViewController" and "ActionController", and PortletModeControllerMapping could take an extra parameter to specify a single ViewController? Something like: <bean id="defaultControllerMapping" class="org.springframework.web.portlet.support.PortletModeControllerMapping" > <property name="portletModeMap"> <map> <entry key="view"><ref local="viewController"/></entry> <entry key="edit"><ref local="editController"/></entry> <entry key="help"><ref local="helpController"/></entry> </map> </property> <property name="actionController"> <ref bean="actionController"/> </property> </bean> |