Building Forms with the Portlet URL Types Use of portlet parameters in forms is

Enhancing Java Portlets 7-21 portlet id11id nameMultipagename titleMultiPage Sampletitle shortTitleMultiPageshortTitle description This portlet depicts switching between two screens all in the context of a Portal page. description timeout40timeout timeoutMessageMultiPage Sample timed outtimeoutMessage renderer class=oracle.portal.provider.v2.render.RenderManager contentTypetexthtmlcontentType showPagehtdocsmultipagefirst.jspshowPage pageParameterNamenext_pagepageParameterName renderer portlet Notice that the value of pageParameterName is the name of a portlet parameter, next_page, that the PDK framework intercepts and interprets as an override to the value of the showPage parameter. If the PDK framework encounters the qualified version of the parameter when the multi-page portlet is requested, it will render the resource identified by next_page rather than first.jsp. Note that the PDK does not render the parameter within the portlet, that responsibility falls to the portlet. You can modify the thesaurus example to operate with the use of this parameter. Specifically, you can use the form submission portlet to be the input for the thesaurus the first page of the portlet, then navigate the user to the results page, which contains links to drill further into the thesaurus. The following examples illustrate these changes. ThesaurusForm.jsp: PortletRenderRequest pRequest = PortletRenderRequest request.getAttributeHttpCommonConstants.PORTLET_RENDER_REQUEST; String paramNameSubmit = submit; String paramNameQ = q; String qualParamNameQ = HttpPortletRendererUtil.portletParameterpRequest, paramNameQ; String qualParamNameSubmit = HttpPortletRendererUtil.portletParameterpRequest, paramNameSubmit; String formName = UrlUtils.htmlFormNamepRequest,query_form; -- Output the HTML content -- center bThesaurusb Enter the word you wish to search for form name== formName method=POST action== UrlUtils.htmlFormActionLinkpRequest,UrlUtils.PAGE_LINK = UrlUtils.htmlFormHiddenFieldspRequest,UrlUtils.PAGE_LINK, formName Note: The example that follows is most useful for relatively simple cases, such as this thesaurus example. If your requirements are more complex for example, you want to build a wizard experience, then you should consider using an MVC framework such as Struts. For information on how to build portlets from struts applications, refer to Section 7.3, Building Struts Portlets with Oracle JDeveloper . 7-22 Oracle Fusion Middleware Developers Guide for Oracle Portal = UrlUtils.emitHiddenField HttpPortletRendererUtil.portletParameterrequest, next_page, htdocspathThesaurusLink.jsp tabletrtd Word of interest: tdtd input type=text size=20 name== qualParamNameQ value= tdtrtable input type=submit name== qualParamNameSubmit Value=Search form center Notice how next_page must be explicitly set to point to ThesaurusLink.jsp. If you do not explicitly set next_page in this way, it defaults to the resource registered in provider.xml, which is ThesaurusForm.jsp. ThesaurusLink.jsp: PortletRenderRequest pRequest = PortletRenderRequest request.getAttributeHttpCommonConstants.PORTLET_RENDER_REQUEST; String paramNameQ = q; String paramNameNextPage = next_page; String qualParamNameQ = HttpPortletRendererUtil.portletParameterpRequest, paramNameQ; String qualParamNameNextPage = HttpPortletRendererUtil.portletParameterpRequest, paramNameNextPage; String paramValueQ = pRequest.getQualifiedParameterparamNameQ; -- Output the HTML content -- center Words similar to = paramValueQ br Click on the link to search for words related to that word. br ul Thesaurus t = new Thesaurus; String[] relatedWords = t.getRelatedWordsparamValueQ; NameValue[] linkParams = new NameValue[2]; linkParams[0] = new NameValue qualParamNameNextPage, htdocspathThesaurusLink.jsp; for int i=0; irelatedWords.length; i++ { linkParams[1] = new NameValue qualParamNameQ, relatedWords[i]; li b = relatedWords[i] b = UrlUtils.constructHTMLLink pRequest, UrlUtils.PAGE_LINK, words related to + relatedWords[i] + , , linkParams, true,