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.jav
a: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 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.