在spring的文档中,对于RequestMapping注释的“值”,他们说:
在Portlet环境中:映射 portlet模式(即“EDIT”,“VIEW”, “帮助”或任何自定义模式。)
使用Liferay 6,我的控制器获得的唯一模式始终是“VIEW”。如何在编辑模式下“成为”或如何使用“自定义模式”?
答案 0 :(得分:0)
您可以通过将@controller(“EDIT”)注释设置为控制器类来获得编辑模式。这应该可以解决你使用弹簧3的问题。你不能总是定义一个defaultannotationhandlermapping并将属性模式作为编辑...
HTH, 夏朗
答案 1 :(得分:0)
更新:我担心这不起作用。自定义模式是JSR的可选部分,对我而言,目前尚不清楚Liferay是否支持它。看看这些JIRA:
您可以将控制器映射到任何自定义模式。但首先需要在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>
...你应该能够将你的控制器映射到这种模式:
@RequestMapping("MY_CUSTOM_MODE")