Thus, I am having trouble figuring out how to handle navigation in liferay. I am new to jsp, portlets and liferay, but I think I have exhausted all the documentation that is looking for an answer.
I am looking for a way to submit an html form and set rendering options with fields. I would like to have URLs that work with normal browser navigation and bookmarks. I figured out how to do this using javascript to update an already declared renderurl with new values ββfrom the form, but I'm trying to find a cleaner way to do this.
I tried several methods right now .. using this page
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %> <%@ page import="com.liferay.portal.kernel.util.ParamUtil" %> <%@ page import="com.liferay.portal.kernel.util.Validator" %> <%@ page import="javax.portlet.PortletPreferences" %> <portlet:defineObjects /> <% PortletPreferences prefs = renderRequest.getPreferences(); String search = ParamUtil.getString(renderRequest, "search"); %> <portlet:renderURL var="viewURL"> <portlet:param name="jspPage" value="/view.jsp" /> </portlet:renderURL> <aui:form action="<%= viewURL %>" method="post"> <aui:input label="search" name="search" type="text" value="<%=search %>" /> <aui:button type="submit" /> </aui:form>
Using post, I get the resulting URL:
http://localhost:8080/web/10157/home?p_p_id=search_WAR_searchportlet_INSTANCE_Kt9C&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_search_WAR_searchportlet_INSTANCE_Kt9C_jspPage=%2Fview.jsp
If I changed the form to get, then I get this url:
http://localhost:8080/web/10157/home?_search_WAR_searchportlet_INSTANCE_Kt9C_search=123
But using renderURL with a set of parameters, I would get this, which is a combination of how both messages are returned and get:
http://localhost:8080/web/10157/home?p_p_id=search_WAR_searchportlet_INSTANCE_Kt9C&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_search_WAR_searchportlet_INSTANCE_Kt9C_jspPage=%2Fview.jsp&_search_WAR_searchportlet_INSTANCE_Kt9C_search=123
So now I can use the form with the message, and ParamUtil.getString will recognize the data, but the link will not be classified, or I can use the form with get, leaving the information in the URL, but I can not get ParamUtil to recognize the data. Even if I could get the recognition data using the receive form, I really do not want to use this, since the parameter will not be saved if I do any form submissions in other portlets. As far as I understand, RenderURLs save these things.
Forgive me if I completely get rid of these things, please. I am new to jsp, portlets and liferay and am pretty lost on how I should do a lot of such things.