我正在尝试从同一页面上的 Hook 检索发布值,因此当我的值正确时,内容就会出现。
我在 Hook 中添加了此代码,以将其显示在指定页面上。
<portlet:actionURL secure="<%= PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure() %>" var="SecondloginURL">
<portlet:param name="saveLastPath" value="0" />
<portlet:param name="struts_action" value="/journal_content/view" />
</portlet:actionURL>
<aui:form action="" name="auth" method="POST">
<aui:input label="Second Password" type="password" name="password" />
<aui:button type="submit" value="authenticate" />
</aui:form>
我设法检索该值,但当验证 session 启动时,它不会跨页面移动。
这是代码:
<% String pass = request.getParameter("password"); %>
<c:if test="<%= pass.equals(\"1234\") %>">
<%
HttpSession session1 = request.getSession();
session1.setAttribute("pass","authenticated");
String foo = (String) session1.getAttribute("pass");
out.println(foo);
%>
<h2>this is the second password and it's working</h2>
<div class="journal-content-article" id="article_<%= articleDisplay.getCompanyId() %>_<%= articleDisplay.getGroupId() %>_<%= articleDisplay.getArticleId() %>_<%= articleDisplay.getVersion() %>">
<%= RuntimePortletUtil.processXML(application, request, response, renderRequest, renderResponse, articleDisplay.getContent()) %>
</div>
</c:if>
最佳答案
在 Liferay Hook 中,您可以覆盖现有的 Liferay jsps,从而还可以添加表单。
您还可以覆盖 Liferay 操作和其他 Liferay 类。您没有明确说明上面的代码放在哪里,以及钩子(Hook)中还有什么,也没有说明您想要实现的目标。
首先:您应该将表单定向到一些 <portlet:actionURL/>
然后,根据调用此 jsp 的 portlet,您必须实现或重写该 portlet 的操作处理程序。在那里您将能够从 ActionRequest
获取参数值。
关于java - Liferay 钩子(Hook)输入帖子在同一页面上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12386679/