2012-05-12 22 views

回答

4

jsp中的重定向並不是真正意義上的權宜之計,因爲下面的jsp解析呈現階段,並且這個階段被隱藏以顯示內容。

另一方面,在下面重定向到操作階段,在這裏您可以決定portlet應該在下一步做什麼。

閱讀本教程爲了更好地理解portlet的兩相: http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/understanding-the-two-phases-of-portlet-execution

因此,把重定向portlet中的processAction梅索德:

@Override 
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { 
    //defaultLandingPage = ... 
    actionResponse.sendRedirect(defaultLandingPage); 
}; 

否則,如果你真的想這樣做的內JSP,您可以在第一個JSP第二個JSP:

<liferay-util:include page="second.jsp" /> 
0

response.sendRedirect(「」);

請注意,路徑可以是相對的,絕對的或相對於服務器根。 另外,如果響應已被提交,它將不起作用。

2
<portlet:renderURL var="other"> 
    <portlet:param name="jspPage" value="/jsp/b.jsp"/> 
    </portlet:renderURL> 
    <a href="<%=other%>">other</a>