This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I suppose it�s a very genuine problem with portlet, I am facing.
When I submit the form, I get all the parameters in processAction() method (in ActionRequest), I do some processing, now I want to set some attributes in request to render them on GUI but rendering part is handled by doView() method, where I have access of RenderRequest, not of ActionRequest. How to achieve this kind of very common functionality?
Using the setRenderParameter and setRenderParameters methods of the ActionResponse interface, you can set render parameters during an action request. After setting in action phase these parameters will be available in render phase (e.g. doView()) and can be retrieved from RenderRequest.
Indeed, using the PortletSession to achieve this functionality is a waste. You don't want to overburden your session.
Setting the swapping properties into the renderparameter in the action phase, and pulling them out in the render phase is definitely the way to go.
Here's a little help from the Sun API JavaDoc for the Portlet JSR168 Spec:
public void setRenderParameters(java.util.Map parameters)
Sets a parameter map for the render request.
All previously set render parameters are cleared.
These parameters will be accessible in all sub-sequent render calls via the PortletRequest.getParameter call until a new request is targeted to the portlet.
The given parameters do not need to be encoded prior to calling this method.
Parameters: parameters - Map containing parameter names for the render phase as keys and parameter values as map values. The keys in the parameter map must be of type String. The values in the parameter map must be of type String array (String). Throws: java.lang.IllegalArgumentException - if parameters is null.