JSF portlet and Public Render Parameters

In this blog i will talk about the support for public render parameter (new feature that was added in Portlet 2.0 specification) in the JSF Portlet Bridge.

In JSFPortletBridge version 1.2.3 an enhancement was added to keep track of request scoped information. Check the issue 30 for more details. This feature can be used to support the sharing of render parameters among jsf portlets. I will explain how to do it. The example war and source is referenced at the end.

1. First you need to set the following initialization parameter in the portlet.xml for the portlet that wants to share the render parameter

This causes the form parameters to be set as render parameters. As a result all form parameters are available in the render of the portlet.

2. Now identify the parameter to be shared and specify it in the portlet.xml. Since JSF generates the name, you need to specify the generated name in the portlet.xml..For example consider the following snippet

    <h:form id="helloForm">
    <h:inputText id="userNo" value="#{UserNumberBean.userNumber}"

If you want to share the inputText "userNo", then specify the parameter "helloForm:userNo" as supported-public-render-parameter.

If you notice i have dropped the tag <p:portletPage> . This tag causes the portlet namespace to be prepended to the parameter name. The parameter name will be "portletnamespace:helloForm:userNo". The namespace that is generated by the portlet container will be different in each portal. So i have removed it.

The parameter can be specified in the portlet.xml as follows..
        <qname xmlns:x="http://www.sun.com/params">x:userNumber</qname>

3. If another JSF Portlet also specifies the same parameter as supported-public-render-parameter, then it can access the parameter as

    FacesContext context = FacesContext.getCurrentInstance();
    PortletRequest request = (PortletRequest)context.getExternalContext().getRequest();
    return request.getParameter("helloForm:userNo");

This will return the value entered in the first JSF Portlet.

Deploy the guessnumbersharedportlet.war on OpenPortal Portlet Container 2.0 and see the public render parameter at work. You can check the sources to see how this is done. The sample will work on Project WebSynergy and Liferay Portal also.


Hi Deepak,
Is it possible to use Events in JSF portlets. Could you please provide some information on this?

Thank you

Posted by APps on June 30, 2009 at 03:59 PM IST #

Yes it is possible to use events in JSF Portlets. This ability with be available in the jsfportletbridge shortly.

Posted by Deepak on July 03, 2009 at 05:26 AM IST #

hello and thanks for this example.
i used it, but i got an error:

SCHWERWIEGEND: /home.xhtml @80,77 value="#{UserNumberBean.userNumber}": Illegal Syntax for Set Operation
19:24:28,375 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=...:_viewRoot:helloForm:userNo[severity=(ERROR 2), summary=
(/home.xhtml @80,77 value="#{UserNumberBean.userNumber}": Illegal Syntax for Set Operation), detail=(/home.xhtml @80,77 va
lue="#{UserNumberBean.userNumber}": Illegal Syntax for Set Operation)]

do you know, what could be the problem ?

Posted by gabe on September 01, 2009 at 04:04 PM IST #

iam sorry!
was only a beginner mistake.
wrong input, wrong naming.

Posted by gabe on September 01, 2009 at 04:21 PM IST #

did the portlets have to be in the same web-application?

Posted by gabe on September 01, 2009 at 04:40 PM IST #

The portlets need not be in the same webapp. In fact the example and sample shown above used two different jsf-portlet webapplication.

Posted by Deepak on September 02, 2009 at 03:40 AM IST #

Hello Deepak,

does the example also work on jboss-portal?

Posted by guest on September 05, 2009 at 02:01 PM IST #

Sorry Deepak,
but the example shows a single .war with the two portlet in it...It's important to me to understand if I' m able to use this approach with portlet within different .war files...

Posted by uskassat on September 15, 2009 at 08:13 AM IST #

You can use this approach with portlet in different wars. As the public render parameter functionality across portlet wars is handled by the portlet container, it should work. I have not tried though. As this was done long time back i thought it was two different wars. Sorry about that. Let me know if it does not work in different wars.

Posted by Deepak on September 15, 2009 at 11:06 AM IST #

This approach works with portlets into different wars using the same jars, but I want to know how can I retrieve the parameter in the display portlet without importing manged bean related jars?

Posted by uskassat on September 15, 2009 at 11:47 AM IST #

sorry .war is not working with liferay 5.2.3!
getting error :
07.04.2010 20:00:10 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/guessnumbersharedportlet] startup failed due to previous errors

any ideas?

Posted by pfeiflo on April 07, 2010 at 06:47 PM IST #

Hi Deepak

I want to implement Public Render Parameters using Jboss Portlet Bridge. Can you please share if you have any reference for that. I have a requirement to pass a parameter between two different portlets located in two different pages.


Posted by Srinadh on April 10, 2010 at 06:39 PM IST #

The guessnumbersharedportlet.war didn't have jsf libraries and hence it may have failed during deployment in Liferay 5.2 on Tomcat. I had tested on Liferay 5.2.3+GlassFish. Now i have updated guessnumbersharedportlet.war with JSF libraries and it should work on Liferay+Tomcat. Clear the browser cache and download guessnumbersharedportlet.war again. Thanks for pointing out the issue.

Posted by Deepak on April 12, 2010 at 05:37 AM IST #

Sorry i don't have any idea on JBoss Portlet Bridge. Did you check JBoss forum.

Posted by Deepak on April 12, 2010 at 05:40 AM IST #

Hello, sources link doesn`t contain archive.

Posted by blindbear on May 01, 2010 at 04:18 PM IST #

Fixed the sources link. Thanks for pointing it out.

Posted by Deepak Gothe on May 03, 2010 at 04:16 AM IST #

Hello Deepak,

Your blog is really great. Its has been great help to a newbie like me regd the JSR 286. I have a wustion here.

I have a secnario where i have to send the params from source portlet to destination portlet and redirecting at the same time. I mean, if i select some loan type in my source portlet and click on a button, i should be redirected to target portlet with the Loan type information ? We do not intend to use portlet Wiring. Can u pls suggest us a solution ?

Thanks in advance,

Posted by Anil Kumar on August 24, 2010 at 03:14 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

Deepak Gothe


« October 2015