myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phanidhar Adusumilli" <>
Subject Javascripts and Namespace encoding in portal environments.
Date Thu, 04 May 2006 19:04:34 GMT
Myfaces implementation is not compliant with section 12.3.4 of portlet spec.

In the current implementation(s) (1.1.1 & 1.1.2)

UIViewRoot.createUniqueId() is implemented as follows:

    /* Provides a unique id for this component instance.
    public String createUniqueId()
        ExternalContext extCtx = FacesContext.getCurrentInstance
        return extCtx.encodeNamespace(UNIQUE_ID_PREFIX +

This makes the id unique for a component, but while rendering the clientId
is used.
Imagine if there is a naming container hierarchy the namespace is repeated
for every naming container.
For example:
if the jsp is as follows:

  <h:inputtext .../>

the id of the form in the markup will be portlet1_id0
and the id of the inputtext will be portlet1_id0:portlet1_id1.

The namespace is unecesarily repeated.

The above implementation will not make the id, in the generated markup
unique if the id is specified in the jsp.

For example:
 <h:form id="Myform">
  <h:inputtext  id="name" .../>

 the id of the form in the markup will be Myform
and the id of the inputtext will be Myform:name.

This does not make them unique in portal environment because createUniqueId
is never called.

My opinion is that the fix should be in UIComponentBase.getClientId() not in

getClientId() must return the namespace encoded client id.

With this
for Problem1:

the id's would be  portlet1_id0 and portlet1_id0:_id1

for Problem2:

the id's would be portlet1_Myform and portlet1_Myform:name.

I would appreciate comments on this from MyFaces developers.

View raw message