Thanks Leonardo,
Already done, but I have another question:
Which is the reason that UIComponentBase.findComponent(String expr) looks for
the searched component, starting from the closest parent that implements
NamingContainer?
Look at this example:
<h:outputText id="text" value="#{bean.texto}"></h:outputText>
<ui:repeat id="repeat" value="#{bean.textos}" var="texto">
<h:commandLink id="command" value="#{texto}">
<f:ajax event="click" listener="#{bean.actionListener}" render="text"/>
</h:commandLink>
</ui:repeat>
If we try to render this view, we get:
javax.faces.FacesException: Component with id:texto not found
This exception is trown by HtmlAjaxBehaviorRenderer.mapToString when he find
every component identified in the render attribute. I think they converts the
id's in the render attribute, to the clientId of every component referenced.
The problem is that UIRepeat implements NamingContainer, so the commandLink
inside that UIRepeat is gonna search the component identified by 'text' inside
the children list of repeat tag.
But it should works, isn't it? Nothing wrong to re render an outputtext from
command link that is inside a repeat.
I have reimplemented method findComponent in my own components, in order to
find the id starting from the view root... and it works.
Is this another bug?
Regards,
Ricard
-----Mensaje original-----
De: Leonardo Uribe [mailto:[email protected]]
Enviado el: lunes, 20 de junio de 2011 19:09
Para: MyFaces Development
CC: RICARD MORE FARRES
Asunto: Re: UIRepeat offset and size problem
Hi
It is a bug. Please create an issue here:
https://issues.apache.org/jira/browse/MYFACES
I have already a patch, so as soon as you create the issue I'll commit
it. Later, you can get a nightly build snapshot here:
https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/
regards,
Leonardo Uribe
2011/6/20 RICARD MORE FARRES <[email protected]>:
> Hello,
>
>
>
> I am testing MyFaces 2.1.1 implemantation, in order to upgrade our
> aplication from version 1.2.7.
>
>
>
> I have found a problem with parameters offset and size of ui:repeat tag.
>
> offset sets the first index of the list to iterate over.
>
> size is the number of element to iterate.
>
>
>
> If I have a list of Strings like this:
>
> private String[] textos = new String[] {"B1", "B2", "B3", "B4", "B5", "B6",
> "B7"};
>
>
>
> public String[] getTextos() {
>
> return textos;
>
> }
>
>
>
> And I declare repeat tag:
>
> <ui:repeat value="#{bean.textos}" var="texto" offset="0" size="1">
>
> <h:outputText value="#{texto}"/><br/>
>
> </ui:repeat>
>
>
>
> It shows elements B1 and B2 (iterate over indexes 0 and 1). If I change
> offset to 1, it will show elements B2 and B3.
>
> But if I set offset="2" in order to ietare over indexes 2 and 3 (elements B3
> and B4), I get an exception:
>
>
>
> javax.faces.FacesException: iteration offset cannot be greater than
> collection size
>
> at
> org.apache.myfaces.view.facelets.component.UIRepeat._validateAttributes(UIRepeat.java:552)
>
> at
> org.apache.myfaces.view.facelets.component.UIRepeat.process(UIRepeat.java:581)
>
> ...
>
>
>
> If I want to avoid this error, size must be allways greater tha offset, but
> it should be possible to iterate over last two elements of a 102 elements
> list starting from index 100, for example (offset=100,size=1).
>
> And should not be "1" the lower value for size? Now, if you set 0 to size,
> ui:repeat iterates once...
>
>
>
> 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.
>
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.