Java 同一页上的Liferay钩子输入帖子

Java 同一页上的Liferay钩子输入帖子,java,forms,liferay,session-variables,posting,Java,Forms,Liferay,Session Variables,Posting,我试图从同一页面上的钩子中检索一个post值,这样当I值正确时,内容就会出现 我在钩子中添加了这段代码,以便将其放在指定的页面上 <portlet:actionURL secure="<%= PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure() %>" var="SecondloginURL"> <portlet:param name="saveLastPath" va

我试图从同一页面上的钩子中检索一个post值,这样当I值正确时,内容就会出现

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

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

这是第二个密码,它正在工作

在Liferay钩子中,您可以覆盖库存Liferay JSP,从而也可以添加表单

您还可以重写Liferay操作和其他Liferay类。你不清楚你把上面的代码放在哪里,你的钩子里还有什么,也不清楚你想要实现什么


首先:您应该将表单指向某个
,然后,根据调用此jsp的portlet,您必须实现或覆盖该portlet的操作处理程序。在那里,您可以从
ActionRequest

中获取参数值,谢谢@Olaf,我正在portlet->journal\u content->view.jsp中工作,我正在为页面的呈现添加新条件,首先,当我打开特定页面时,我将看到此表单,我需要使用常量值验证它,比如说“1234”当输入值相同时,它将显示内容。@HaiderGhaleb为什么不将附加信息放在问题本身内,以便对希望帮助您的其他人有更大的可见性。Thanks@prakash-k我现在将编辑我的帖子,因为我已经解决了部分问题,所以它将包含更多具体的信息和代码示例