开发者

Liferay 6.0.5 and Spring MVC 3 question

开发者 https://www.devze.com 2023-02-19 14:02 出处:网络
In spring\'s documentation, for the \"value\" at the RequestMapping annotation, they say : In a Portlet environment: the mapped

In spring's documentation, for the "value" at the RequestMapping annotation, they say :

In a Portlet environment: the mapped port开发者_如何学Pythonlet modes (i.e. "EDIT", "VIEW", "HELP" or any custom modes).

Here's the source : http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/web/bind/annotation/RequestMapping.html

With Liferay 6, the only mode that my controller gets is always "VIEW". How can I "be" in EDIT mode or how can I use a "custom mode"?


You can get the edit mode by setting the @controller("EDIT") annotation to the controller class. This should work wince you are using spring 3. It not you can always define a defaultannotationhandlermapping and give a property mode as edit...

HTH, Sharan


UPDATE: I am afraid this doesn't work. Custom modes is an optional part of the JSR, and to me it is unclear if Liferay supports it. Have a look at these JIRA's:

  • http://issues.liferay.com/browse/LPS-4090
  • http://issues.liferay.com/browse/LPS-13233

You can map your controller to any custom mode. But first you need to define custom modes in your portlet.xml:

<portlet-app>
   ...
   <portlet>
      ...
      <supports>
         <mime-type>text/html</mime-type>
         <portlet-mode>view</portlet-mode>
         <portlet-mode>edit</portlet-mode>
         <portlet-mode>MY_CUSTOM_MODE</portlet-mode>
      </supports>
   </portlet>

   <custom-portlet-mode>
      <portlet-mode>MY_CUSTOM_MODE</portlet-mode>
   </custom-portlet-mode>
</portlet-app>

...and you should be able to map your controller to this mode like this:

@RequestMapping("MY_CUSTOM_MODE")
0

精彩评论

暂无评论...
验证码 换一张
取 消