0

我正在尝试从同一页面上的挂钩中检索帖子值,因此当我的值正确时,会出现内容。

我在钩子中添加了这段代码以将其放在指定的页面上。

<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>

我设法检索了该值,但是当它经过验证的会话开始时,它不会跨页移动。

这是代码:

<% 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>
4

1 回答 1

1

在 Liferay 挂钩中,您可以覆盖现有的 Liferay jsps,因此也可以添加表单。

您还可以覆盖 Liferay Actions 和其他 Liferay 类。您不清楚将上述代码放在哪里以及钩子中还有什么,也不清楚您要实现的目标。

首先:您应该将您的表单定向到某个<portlet:actionURL/>,然后,根据调用此 jsp 的 portlet,您必须实现或覆盖该 portlet 的操作处理程序。在那里,您将能够从ActionRequest

于 2012-09-12T11:49:47.623 回答