<%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" session="false" %>

<%
    response.setContentType("text/html;charset=UTF-8"); 

    // The form submit URL refers to the current Portal page.  All portlets
    // on this page share this URL.  This means that the per portlet parameters
    // are in the same request.  Portlets must ensure that its paramerters don't
    // collide either with other portlets or other instances of itself.  This
    // is generally accomplished by using "fully-qualified" parameter names. A
    // fully-qualified parameter name prepends the (unique) portlet reference to
    // the parameter.  The JPDK provides a utility to accomplish this.

    // Since we dont need other portlets to read this parameter, we can qualify
    // it so the page knows that this parameter belongs to only this portlet
    // instance.

    String pSubmitThis = HttpPortletRendererUtil.portletParameter(request, "myParamSubmitThis");

%>

<!-- Output the HTML content -->

<BODY>

This Parameter Passing portlet can talk to the Parameter Receiving portlet by using shared parameter names.  Please ensure that you've added the Parameter Receiving portlet to the same page too. <p> 
<p>
<center>

<form name="parameters" method="POST" action="<%= HttpPortletRendererUtil.htmlFormActionLink(request,PortletRendererUtil.PAGE_LINK) %>" >

<%= HttpPortletRendererUtil.htmlFormHiddenFields(request,PortletRendererUtil.PAGE_LINK) %>

Welcome to the <p>
<b>
<%

    // Check to see if the button for displaying parameter in THIS 
    // portlet only has been pressed.
    // If so print the value of the parameter that gets passed 
    // automatically with the query string of the URL. 

    if (request.getParameter(pSubmitThis) != null )
    {
%>
       <%= request.getParameter("sampleParams.unqualifiedParamName") %>
<%
    }
%>
</b>
portlet <p>

<b>Write your name below:</b> <br>

<!-- Provide unqualified name as parameter to be read by other portlet -->
<input type="text" size="20" name="sampleParams.unqualifiedParamName" value=""  > <br>

<!-- Provide qualified name as parameter need not be read by other portlet -->
<input type=submit name="<%= pSubmitThis %>" value="Display in this portlet" > 

<!-- Provide unqualified name as parameter to be read by other portlet -->
<input type=submit name="sampleParams.unqualifiedSubmitAll" value="Display in other portlet" > 

</form>


</center>
</BODY>
<!-- End output the HTML content -->
