Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-1478

Multivalued public render parameters are not handled correctly when outputted inside h:outputlink

    Details

      Description

      I've come across a strange bug. I have a public render parameter categoryId that can hold multiple values. Inside one of my managed beans, I programmatically create render urls with values for this render parameter, like so:

      public String getPortletUrl() {
      	PortletURL renderUrl = LiferayFacesContext.getInstance().createRenderURL();
      	renderUrl.setParameter("categoryId", new String[] {"111", "222"});
      	return renderUrl.toString();
      }
      

      I want to simply display this URL as a clickable link in my JSF view:

      <f:view
      	xmlns="http://www.w3.org/1999/xhtml"
      	xmlns:f="http://java.sun.com/jsf/core"
      	xmlns:h="http://java.sun.com/jsf/html"
      >
      	<h:head/>
      	<h:body>
      		<h:outputLink value="#{bean.portletUrl}">
      			<h:outputText value="#{bean.portletUrl}"/>
      		</h:outputLink>
      	</h:body>
      </f:view>
      

      I suspect a URL of the form:

      /web/guest/prp-test?[...]p_r_p_564233524_categoryId=111&p_r_p_564233524_categoryId=222

      My outputText element outputs indeed this. However, in the outputLink element the second value is repeated twice. So the link becomes:

      /web/guest/prp-test?[...]p_r_p_564233524_categoryId=222&p_r_p_564233524_categoryId=222

      Notice that the first PRP value has changed into 222. How is this possible? Does the Faces bridge rewrite portlet url's if they occur inside an outputLink element? If I use the same URL inside a non-JSF <a> element, the URL is OK:

      <f:view
      	xmlns="http://www.w3.org/1999/xhtml"
      	xmlns:f="http://java.sun.com/jsf/core"
      	xmlns:h="http://java.sun.com/jsf/html"
      >
      	<h:head/>
      	<h:body>
      		<a href="#{bean.portletUrl}">
      			<h:outputText value="#{bean.portletUrl}"/>
      		</a>
      	</h:body>
      </f:view>
      

      It seems that this behavior really breaks IPC for render parameters with multiple values... Thanks for looking into this.

        Attachments

          Activity

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                liferay-faces-2.1.2-ga3
                liferay-faces-3.0.2-legacy-ga3
                liferay-faces-3.0.2-ga3
                liferay-faces-3.1.2-ga3