On Wed, 10 Mar 2004 [EMAIL PROTECTED] wrote:

> Hi,
> First of all, sorry for my poor english, but please read carefully.
>
> I am a developer who use Struts for building RDBMS-based applications.
> I have to make so many tables that is linked by PK-FK relation.
> So There's so many Beans that are shaped like this
> (ParentBean and ChildBean is linked by PK-FK)
>
> ============================================================
> ParentBean.java
>
> public class ParentBean {
>   private int id;
>   private String name;
>   private ChildBean[] childBeans = new ChildBean[0];
>   // get/set methods
>   // ...
> }
> ------------------------------------------------------------
> ChildBean.java
>
> public class ChildBean {
>   private String childName;
>   // get/set methods
>   // ...
> }
> ============================================================
>
> ParentBean can have many, more than one ChildBeans,
> And I cannot guess how many ChildBeans would be created at run-time.
> So this page that is used for user-input cannot be worked properly.
>
> ============================================================
> ParentBeanInput.jsp
> ..
> <html:text property="parentBean.childBeans[0].childName"/><br/>
> <html:text property="parentBean.childBeans[1].childName"/><br/>
> <html:text property="parentBean.childBeans[2].childName"/><br/>
> <html:text property="parentBean.childBeans[3].childName"/>
> ..
> ============================================================
>
> When request parameter is populated(when RequestUtils.populate() is
> called.),
> Array IndexOutofBoundary Exception is occured
> Because Property Entities like parentBean.childBeans[3].childName does not
> exist.
>
> So I use modified beanutils library that can extends length of arraies at
> run-time
> and make a component of array to populate this kind of request parameter
> that
> is mapped to array property of bean.
>
> I would like to Form-Bean processor that support array of variable length.

First of all, this type of question should be asked on struts-user, where
there are probably lots of people who have needed to do the same thing.

In any case, take a look at the LazyList class in Commons Collections. I
think this should do what you want.

http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/list/LazyList.html

--
Martin Cooper


>
> Thank you for reading,Jang
>
> _________________________________________________________________
> 고.. 감.. 도.. 사.. 랑.. 만.. 들.. 기.. MSN 러브
> http://www.msn.co.kr/love/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to