Passing parameters to Portlets
Here I have attached one zip file called HelloWorld.zip. This file contains everything that is needed for building a HelloWorld Portlet. Now after you deploy the helloworldportlet.war this is what you need to do for getting the request parameters in the RenderRequest.
Notice that the URL is targeted to the PortletWindow rather than the Portal itself. Now the parameters passed are "action=1", signifying that the processAction method be called and "testParam=2" the actual request parameters. This will show the output as:
RenderRequest Parameters test=2
Here is what the explanation for this is:
RenderRequest is only to be used when you want the action to change certain rendering parameters, so eventually REQUEST PARAMETERS travel only till "processAction" method. From there whether you want this parameter to be passed to the "doView" method or not is left up to the portlet implementation. This is implemented like this for separation of the action and view concerns, a tidy application programming pattern!
There are also special parameters passed to the ActionRequest. These also need to be set manually in the response like:
However, this is a rather fragile solution. It should do what you want but as a general rule, portlets are not bound to URLs so you shouldn't rely on a URL targetting a Portlet. Only URLs generated via PortletURLs from within a Portlet can be trusted as Portal manages URL in a specific way and the URL format should be considered opaque since it can change (it has already in the past) without notice.
Static link to other pages
So ok this is fine for bookmarking and stuff, but how do I really pass control from one Portal Page to another. Let's say I want to link to the Weather Portlet, how can I do that. Here is an example:
<a href="/portal/portal/default/Weather/WeatherPortletWindow?windowstate=maximized">Weather Page</a>
Notice that if you need authenticated users only then you need to add the "auth" path to the url like "/portal/auth/portal/...". This needs to be done only in static contents like CMS etc.,
For Portal urls please see here: Portal urls
From within your portlet, if you want to pass parameters to another portlet and link to that portlet, please use the technique mentioned in our guide: