So, lets say I have a search form at the top of a page in one portlet. All you want it to do is take the parameters and forward it to a search form. Simple right?
Sort of... So let me copy all the code that pertains to this whole thing in order of processing.
[PORTLET A: VIEW.JSP]
<portlet:actionURL var="editContentURL">
<portlet:param name="method" value="find-a-job" />
</portlet:actionURL>
<aui:form action="<%= editContentURL %>" method="post">
<aui:input name="<portlet:namespace />jobTitle" placeholder="Job Title" />
<aui:button type="submit" value="Submit" />
</aui:form>
[PORTLET A: CUSTOM MVC PORTLET > processAction( )]
ThemeDisplay themeDisplay = (ThemeDisplay)aReq.getAttribute(WebKeys.THEME_DISPLAY);
String jobTitle = ParamUtil.getString(aReq, "<portlet:namespace />jobTitle");
String redirect = themeDisplay.getPortalURL() + "/web/48924/jobseekers/find-a-job?jobTitle=" + jobTitle;
aResp.sendRedirect(redirect);
[PORTLET B: CUSTOM MVC PORTLET > doView() ]
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String jobTitle = httpReq.getParameter("jobTitle");
log.info("jobTitle = " + jobTitle);
renderRequest.setAttribute("jobTitle", jobTitle);
[PORTLET B: VIEW.JSP ]
<% String jobTitle = (String)request.getAttribute("jobTitle"); %>
<aui:input label="Job Title or Keywords" name="<portlet:namespace />title" cssClass="title1" value="<%= jobTitle %>" />
No comments:
Post a Comment