<portlet:actionURL var="meTooURL">
<portlet:param name="struts_action" value="/message_boards/edit_message" />
<portlet:param name="<%= Constants.CMD %>" value="METOO" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="redirect" value="<%= PortalUtil.getCurrentCompleteURL(request) %>" />
<portlet:param name="messageId" value="<%= String.valueOf(message.getMessageId()) %>" />
</portlet:actionURL>
<liferay-ui:icon
id="<%= String.valueOf(message.getMessageId()) %>"
image="me-too"
label="<%= false %>"
message="Me Too"
url="<%= meTooURL %>"
/>
以下是我的日志:
12:18:04,274 WARN [http-bio-8081-exec-39][PortletRequestProcessor:157] This URL can only be invoked using POST: /web/testdrive/message?p_auth=z9cdLBCVGIoF26tN9s7xHqtzgyzpZ1mY&p_p_id=19&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_19_cmd=METOO&_19_redirect=http%3A%2F%2Fjcdev.test.com%2Fweb%2Ftestdrive%2Fmessage%2F-%2Fmessage_boards%2Fmessage%2F94122&_19_redirect=http%3A%2F%2Fjcdev.test.com%2Fweb%2Fthread%2Fposts-notifications%2F94122&_19_struts_action=%2Fmessage_boards%2Fedit_message&_19_messageId=94122
12:18:04,322 ERROR [http-bio-8081-exec-39][render_portlet_jsp:132] null
com.liferay.portal.security.auth.PrincipalException: /web/testdrive/message?p_auth=z9cdLBCVGIoF26tN9s7xHqtzgyzpZ1mY&p_p_id=19&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_19_cmd=METOO&_19_redirect=http%3A%2F%2Fjcdev.test.com%2Fweb%2Ftestdrive%2Fmessage%2F-%2Fmessage_boards%2Fmessage%2F94122&_19_redirect=http%3A%2F%2Fjcdev.test.com%2Fweb%2Fthread%2Fposts-notifications%2F94122&_19_struts_action=%2Fmessage_boards%2Fedit_message&_19_messageId=94122
答案 0 :(得分:0)
正如@Pankajkumar Kathiriya明智地指出的那样,问题不在于权限,而是当操作需要POST请求来处理操作方法时,您正在发出GET请求。我会尝试将图标的方法定义为POST:
<liferay-ui:icon
id="<%= String.valueOf(message.getMessageId()) %>"
image="me-too"
label="<%= false %>"
message="Me Too"
url="<%= meTooURL %>"
method="post"
/>
如果失败 - 抱歉,我现在无法测试:( - 你可以编写一个JavaScript函数来通过POST提交请求,并将其从onClick
标记中提供给<liferay-ui:icon>
参数。