myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phanidhar Adusumilli" <phanidhar.adusumi...@gmail.com>
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
().getExternalContext();
        return extCtx.encodeNamespace(UNIQUE_ID_PREFIX +
_uniqueIdCounter++);
    }

This makes the id unique for a component, but while rendering the clientId
is used.
Problem1:
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:form>
  <h:inputtext .../>
</h:form>

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.

Problem2:
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" .../>
</h:form>

 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
UIViewRoot.createUniqueId().

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.

Mime
View raw message