You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Phanidhar Adusumilli (JIRA)" <de...@myfaces.apache.org> on 2006/05/08 15:17:22 UTC

[jira] Commented: (MYFACES-454) UIViewRoot#createUniqueId() does not return an unique id in Portlet environment.

    [ http://issues.apache.org/jira/browse/MYFACES-454?page=comments#action_12378416 ] 

Phanidhar Adusumilli commented on MYFACES-454:
----------------------------------------------

Based on JSF specification section 3.1.6 and Portlet Specification section 12.3.4, MyFaces implementation (UIViewRoot and UIComponentBase) do not provide unique client id's.
 
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:
With this the namespace is repeated for every component. 
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.

> UIViewRoot#createUniqueId() does not return an unique id in Portlet environment.
> --------------------------------------------------------------------------------
>
>          Key: MYFACES-454
>          URL: http://issues.apache.org/jira/browse/MYFACES-454
>      Project: MyFaces Core
>         Type: Bug

>   Components: General
>     Versions: 1.1.0
>  Environment: Apache Portals Jetspeed2 2.0-M4-SNAPSHOT
>     Reporter: Shinsuke SUGAYA
>     Assignee: Stan Silvert
>      Fix For: 1.1.0
>  Attachments: UIViewRoot.patch
>
> In Portlet environment, if you put multiple portlets created by MyFaces to one page, the duplicated id is used on each portlets.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira