You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Vitaly Venediktov <vi...@ericsson.com> on 2008/02/19 10:17:08 UTC

Faces append suffix to given id

Hi, 

My jsp looks like

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>


<h:form id="taskListData">
	<h:panelGrid>
		<rich:panel>
			<f:facet name="header">
				<h:outputText value="#{...}" />
			</f:facet>
			<rich:dataTable id="taskListData_table"
var="taskList"
				columnClasses="align_hcenter"
value="#{...}">
---skip---
	
			</rich:dataTable>
		</rich:panel>
	</h:panelGrid>
</h:form>

Rendered ID for dataTable in html looks like
"taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
expected "taskListData:taskListData_table" as id. It was as expected
just before update to new faces revision. Do you know the cause of this
behavior?

Best Regards
Vitaly

Re: Faces append suffix to given id

Posted by Curtiss Howard <cu...@jprojects.net>.
Andrew Robinson wrote:
> Isn't that intentionally done when using JSP w/ JSF when there are jsp includes?
>   
I think you're correct.  I just tried doing some includes with 1.2.2 and 
if there are no other components with the same ID the ID will render as 
expected.  If I tried including the same JSP twice in the same page, the 
second instance of the components were rendered with "j_id" suffixes.  
This makes sense as element IDs have to be unique and JSP includes 
introduce a level of uncertainty about uniqueness.

Still, I have to wonder what's going on in this situation (and the one 
reported in MYFACES-1807) since it doesn't seem as though multiple 
components with the same IDs are being included in the same page.  
Vitaly, could you perhaps come up with a minimal set of pages that 
reproduces this scenario (i.e., no Richfaces stuff, please)?  I could 
try and see if I can figure out what's going on.

Thanks,


Curtiss Howard

> On Feb 19, 2008 2:17 AM, Vitaly Venediktov
> <vi...@ericsson.com> wrote:
>   
>>
>> Hi,
>>
>> My jsp looks like
>>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
>> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
>> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
>> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
>>
>>
>> <h:form id="taskListData">
>>         <h:panelGrid>
>>                 <rich:panel>
>>                         <f:facet name="header">
>>                                 <h:outputText value="#{...}" />
>>                         </f:facet>
>>                         <rich:dataTable id="taskListData_table"
>> var="taskList"
>>                                 columnClasses="align_hcenter"
>> value="#{...}">
>> ---skip---
>>
>>                         </rich:dataTable>
>>                 </rich:panel>
>>         </h:panelGrid>
>> </h:form>
>>
>> Rendered ID for dataTable in html looks like
>> "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
>> expected "taskListData:taskListData_table" as id. It was as expected just
>> before update to new faces revision. Do you know the cause of this behavior?
>>
>> Best Regards
>> Vitaly
>>     


Re: Faces append suffix to given id

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Hi,

Adding namespaces, eg
  taskListData:taskListData_table
is fine, as Vitaly notes.

Or
    foo:j_id_1
for the case where the child has no explicit id.

But something like "tasklistDataj_id_1" just looks like a bug to me.

However the odd thing is that it seems to work fine for me. From the app
I'm currently working on:
   id="j_id62:itemlist:5:j_id84"

Maybe it is something specific to richfaces components? If you modify
your page to use just normal JSF components, does the problem occur?

Regards,
Simon


Andrew Robinson schrieb:
> Isn't that intentionally done when using JSP w/ JSF when there are jsp includes?
>
> On Feb 19, 2008 2:17 AM, Vitaly Venediktov
> <vi...@ericsson.com> wrote:
>   
>>
>> Hi,
>>
>> My jsp looks like
>>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
>> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
>> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
>> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
>>
>>
>> <h:form id="taskListData">
>>         <h:panelGrid>
>>                 <rich:panel>
>>                         <f:facet name="header">
>>                                 <h:outputText value="#{...}" />
>>                         </f:facet>
>>                         <rich:dataTable id="taskListData_table"
>> var="taskList"
>>                                 columnClasses="align_hcenter"
>> value="#{...}">
>> ---skip---
>>
>>                         </rich:dataTable>
>>                 </rich:panel>
>>         </h:panelGrid>
>> </h:form>
>>
>> Rendered ID for dataTable in html looks like
>> "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
>> expected "taskListData:taskListData_table" as id. It was as expected just
>> before update to new faces revision. Do you know the cause of this behavior?
>>
>> Best Regards
>> Vitaly
>>     
>
>   


Re: Faces append suffix to given id

Posted by Andrew Robinson <an...@gmail.com>.
Isn't that intentionally done when using JSP w/ JSF when there are jsp includes?

On Feb 19, 2008 2:17 AM, Vitaly Venediktov
<vi...@ericsson.com> wrote:
>
>
>
> Hi,
>
> My jsp looks like
>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
>
>
> <h:form id="taskListData">
>         <h:panelGrid>
>                 <rich:panel>
>                         <f:facet name="header">
>                                 <h:outputText value="#{...}" />
>                         </f:facet>
>                         <rich:dataTable id="taskListData_table"
> var="taskList"
>                                 columnClasses="align_hcenter"
> value="#{...}">
> ---skip---
>
>                         </rich:dataTable>
>                 </rich:panel>
>         </h:panelGrid>
> </h:form>
>
> Rendered ID for dataTable in html looks like
> "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
> expected "taskListData:taskListData_table" as id. It was as expected just
> before update to new faces revision. Do you know the cause of this behavior?
>
> Best Regards
> Vitaly

Re: Faces append suffix to given id

Posted by Matthias Wessendorf <ma...@apache.org>.
if time allows you to provide a fix, things are faster.

thanks,
Matthias

On Feb 19, 2008 10:59 AM, Vitaly Venediktov
<vi...@ericsson.com> wrote:
> Hi,
>
> Yes, I've used myfaces 1.2.0 and it was ok. After I updated the version
> to 1.2.2 it doesn't worked properly. I just found this (MYFACES-1807)
> ticket at issues.apache.org which describes similar behavior, but this
> ticket is still unassigned. :(
>
> BR
> Vitaly
>
>
> -----Original Message-----
> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf Of
> Matthias Wessendorf
> Sent: Tuesday, February 19, 2008 10:26
> To: MyFaces Discussion
> Subject: Re: Faces append suffix to given id
>
> Hi,
>
> *snip*
> > Rendered ID for dataTable in html looks like
> > "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
>
> > expected "taskListData:taskListData_table" as id. It was as expected
> > just before update to new faces revision. Do you know the cause of
> this behavior?
>
> so, an update to myfaces caused this? Or what are you saying.
>
> -M
>
> >
> > Best Regards
> > Vitaly
>
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> mail: matzew-at-apache-dot-org
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

RE: Faces append suffix to given id

Posted by Vitaly Venediktov <vi...@ericsson.com>.
Hi,

Yes, I've used myfaces 1.2.0 and it was ok. After I updated the version
to 1.2.2 it doesn't worked properly. I just found this (MYFACES-1807)
ticket at issues.apache.org which describes similar behavior, but this
ticket is still unassigned. :(

BR
Vitaly

-----Original Message-----
From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf Of
Matthias Wessendorf
Sent: Tuesday, February 19, 2008 10:26
To: MyFaces Discussion
Subject: Re: Faces append suffix to given id

Hi,

*snip*
> Rendered ID for dataTable in html looks like 
> "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I

> expected "taskListData:taskListData_table" as id. It was as expected 
> just before update to new faces revision. Do you know the cause of
this behavior?

so, an update to myfaces caused this? Or what are you saying.

-M

>
> Best Regards
> Vitaly



--
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: Faces append suffix to given id

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi,

*snip*
> Rendered ID for dataTable in html looks like
> "taskListDataj_id_1:taskListData_tablej_id_1". It is confusing since I
> expected "taskListData:taskListData_table" as id. It was as expected just
> before update to new faces revision. Do you know the cause of this behavior?

so, an update to myfaces caused this? Or what are you saying.

-M

>
> Best Regards
> Vitaly



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org