Liferay研究之十一:Portlet与Struts Action Path的关系引发的问题

来源:互联网 发布:陈坤人品怎么样 知乎 编辑:程序博客网 时间:2024/05/16 02:01

Liferay开发中出现The struts path xxx does not belong to portlet xx. Check the definition in liferay-portlet.xml问题如何解决?

一种情况是因为在一个Portlet中引用另外一个portlet的URL导致的。比如在Configuration Portlet中想执行View Article Content的操作。

问题发生点:PortletRequestProcesser.java, line 321.

原因:你引用的portletURL struts-path与你当前的portlet struts-path不匹配,这种情况下,如果你是以guest身份登录,而且这些资源都是对guest开放的,就不会报错。如果你登录了,就会因为权限问题报错。

因为在Liferay中对权限的定义较严格。

比如在Journal_articles基础上,你想做一个文章共享的Portlet 其Struts-path为journal_shared, 这与JournalArticles的journal_articles不同。所以,你在journal_shared/view.jsp就需要修改portletURL.struts_action为journal_shared/view。而不能直接拷贝journal_articles/view。

相应的,你需要在struts-conf中定义对应的配置。
 

原创粉丝点击