我正在尝试从同一页面的钩子中检索POST值,这样当我的值正确时,内容就会出现。
我在钩子中添加了这段代码,使其位于指定的页面上。
<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>发布于 2012-09-12 19:49:48
在Liferay钩子中,您可以覆盖股票Liferay jsps,因此还可以添加表单。
还可以覆盖Liferay操作和其他Liferay类。你不清楚你把上面的代码放在哪里,你的钩子里还有什么,也不清楚你想要实现什么。
首先:您应该将表单定向到某个<portlet:actionURL/>,然后,根据调用此jsp的portlet,您必须实现或覆盖该portlet的操作处理程序。在那里,您将能够从ActionRequest中获取参数值
https://stackoverflow.com/questions/12386679
复制相似问题