Look at ListUtils.lazyList()
http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect
ions/ListUtils.html#lazyList(java.util.List,%20org.apache.commons.collection
s.Factory)

robert

> -----Original Message-----
> From: Paulo Rezende [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 05, 2004 1:03 PM
> To: Struts Users Mailing List
> Subject: Adding items to a vector of formbean in the jsp
>
>
> Struters,
>
> I need help from somebody.
>
> I have a formbean that has a vector property, and my jsp has a
> iterator that renderizes this:
>
>   <input type="hidden" name="userList[0].id"   value="1"     id="id0">
>   <input type="hidden" name="userList[0].name" value="paul" id="name0">
>
>   <input type="hidden" name="userList[1].id"   value="2"     id="id1">
>   <input type="hidden" name="userList[1].name" value="john" id="name1">
>
> If i change the value of any of these inputs and submit the page,
> the requestprocessor parse and update the values of the vector in
> the formbean correctly.
>
> But if i, dinamicly with dom, create new inputs increasing the
> index (like in the example below) and submit the page, i get a
> exception of Beans.populate(), a out of ranger error.
>
>       newInput = document.createElement("input");
>       newInput.type = "hidden";
>       newInput.name = "userList[2].id";
>       newInput.id   = "id2";
>       myHmtlBody.appendChild(inp);
>
>       document.getElementById("id2").value = 3;
>
>       newInput = document.createElement("input");
>       newInput.type = "hidden";
>       newInput.name = "userList[2].name";
>       newInput.id   = "name2";
>       myHmtlBody.appendChild(inp);
>
>       document.getElementById("name2").value = "peter";
>
> What i really want is that, when i submit the page, the
> requestprocessor add a new item in the vector and set the values
> of the new item with the values of the new inputs.
>
> Anybody have any thing to say or suggest, any idea?
>
> thanks, Paulo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to