You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by RICARD MORE FARRES <ri...@mango.com> on 2011/03/02 13:02:37 UTC
Problem with ui:repeat and behaviorized commandLink
Hi,
I'm trying to upgrade from MyFaces 1.2.7 to 2.0.4 our online store. To
do it, I need to adapt our own UICommand components to the new version.
I'm working on overwrite your HTMLLinkRendererBase in order to adapt it
to our graphic requirements, but keeping original javascript generation.
Now I think I have found a bug if there is a commandLink or
commandButton with ajax behavior, inside a ui:repeat tag. For example:
<h:outputText id="texto" value="#{bean.texto}">
</h:outputText>
<br/><br/>
<ui:repeat value="#{bean.textos}" var="text">
<h:commandLink id="boton10" value="#{text}">
<f:ajax event="click" render="texto"
listener="#{bean.actionListenerLink}"/>
</h:commandLink>
<br/>
</ui:repeat>
If there is no ajax modifier, all works fine, but if there's they trhow
a:
javax.faces.FacesException: Component with id:texto not found
org.apache.myfaces.renderkit.html.HtmlAjaxBehaviorRenderer.getComponentI
d(HtmlAjaxBehaviorRenderer.java:289)
I have solved it rewriting the findComponent(String id) method in our
implementation, in order to search for the 'render' id (texto in the
example) starting from the viewRoot.
I think the problem is that in the UIComponentBase.findComponent(String
id) it looks for the referenced component, starting from the closest
NamingContainer to the source element:
if (this instanceof NamingContainer)
{
findBase = this;
}
else
{
findBase = _ComponentUtils.findParentNamingContainer(this, true /* root
if not found */);
}
And, I'm not sure, but I think ui:repeat related component should
implements NamingContainer, so it looks for the referenced component
only inside the ui.repeat tag. Could it be? And could it be solved?
Thanks in advance!
Ricard
Para el medioambiente cada gesto cuenta: por favor, no imprimas este e-mail si no es realmente necesario
Este correo y sus archivos asociados son privados y confidenciales y va dirigido exclusivamente a su destinatario. Si
recibe este correo sin ser el destinatario del mismo, le rogamos proceda a su eliminacion y lo ponga en conocimiento
del emisor. La difusion por cualquier medio del contenido de este correo podr�a ser sancionada conforme a lo previsto
en las leyes espanyolas. No se autoriza la utilizacion con fines comerciales o para su incorporacion a ficheros
automatizados de las direcciones del emisor o del destinatario.
Each one of us can do our bit for the environment: please, do not print this e-mail unless it is absolutely essential.
This mail and its attached files are confidential and are exclusively intented to their addresses. In case you may
receive this mail not being its address, we beg you to let us know the error by reply and to proceed to delete it. The
circulation by any mean of this mail could be penalised in accordance with the Spanish legislation. The use of both
the transmitter and the addresses with a commercial aim, or in order to be incorporated to automated files,
is not authorized.
Re: Problem with ui:repeat and behaviorized commandLink
Posted by Scott O'Bryan <da...@gmail.com>.
Well, it's impossible for repeat to implement a naming container for quite a
few reasons. The thing is, I think your treating UI:repeat as if it was a
stamped type component and it's not. It's a tag and I think that you end up
with more then one component in the component tree with the same id.
What happens if you use UI:repeat's varstatus.index to add an index on to
the ID. Does that give you the behavior your looking for?
Scott
On Mar 2, 2011, at 5:03 AM, RICARD MORE FARRES <ri...@mango.com>
wrote:
Hi,
I’m trying to upgrade from MyFaces 1.2.7 to 2.0.4 our online store. To do
it, I need to adapt our own UICommand components to the new version. I’m
working on overwrite your HTMLLinkRendererBase in order to adapt it to our
graphic requirements, but keeping original javascript generation.
Now I think I have found a bug if there is a commandLink or commandButton
with ajax behavior, inside a ui:repeat tag. For example:
<h:outputText id="texto" value="#{bean.texto}">
</h:outputText>
<br/><br/>
<ui:repeat value="#{bean.textos}" var="text">
<h:commandLink id="boton10" value="#{text}">
<f:ajax event="click" render="texto" listener="
#{bean.actionListenerLink}"/>
</h:commandLink>
<br/>
</ui:repeat>
If there is no ajax modifier, all works fine, but if there’s they trhow a:
javax.faces.FacesException: Component with id:texto not found
org.apache.myfaces.renderkit.html.HtmlAjaxBehaviorRenderer.getComponentId(HtmlAjaxBehaviorRenderer.java:289)
I have solved it rewriting the findComponent(String id) method in our
implementation, in order to search for the ‘render’ id (texto in the
example) starting from the viewRoot.
I think the problem is that in the UIComponentBase.findComponent(String id) it
looks for the referenced component, starting from the closest
NamingContainer to the source element:
if (this instanceof NamingContainer)
{
findBase = this;
}
else
{
findBase = _ComponentUtils.findParentNamingContainer(this, true /* root if
not found */);
}
And, I’m not sure, but I think ui:repeat related component should implements
NamingContainer, so it looks for the referenced component only inside the
ui.repeat tag. Could it be? And could it be solved?
Thanks in advance!
Ricard
Para el medioambiente cada gesto cuenta: por favor, no imprimas este e-mail
si no es realmente necesario.
Este correo y sus archivos asociados son privados y confidenciales y va
dirigido exclusivamente a su destinatario. Si recibe este correo sin ser el
destinatario del mismo,le rogamos proceda a su eliminación y lo ponga en
conocimiento del emisor. La difusión por cualquier medio del contenido de
este correo podría ser sancionada conforme a lo previsto en las leyes
españolas. No se autoriza la utilización con fines comerciales o para su
incorporación a ficheros automatizados de las direcciones del emisor o del
destinatario.
Each one of us can do our bit for the environment: please, do not print this
e-mail unless it is absolutely essential.
This e-mail and its attached files are confidential and are exclusively
intented for their addressees. If you have received this e-mail and it is
not addressed to you, please notify us of the error by replying to it before
proceeding to delete it. The diffusion of the contents of this e-mail by
whatever means may be penalised in accordance with Spanish law. The
utilisation of the addresses of the sender and the addressee for commercial
purposes or for inclusion on computer files is not authorized.