This will still work, but is really NOT object oriented. And it will also bring other design problems along with it. What if the user can choose to enter the number of family members he has before specifying their details? E.g. he can choose 3 members and the form will display only 3 sets of fields for him to fill in.

In that case, how many sets of fields must we hard-code in our form bean?

I am sure there are better ways, perhaps through xml or writing custom tag libraries. Just hope that someone could enlighten me if such extension already exist in STRUTS.

Keep in mind though that the visibility is another problem. How many fiels should you display, is user allowed to input how many fiels he/she wants, etc... are question that you might handle depending on your business logic. [ September 06, 2004: Message edited by: Leandro Melo ]

Leandro Melo
SCJP 1.4, SCWCD 1.4

Raymond Chiam
Greenhorn

Joined: Apr 06, 2004
Posts: 2

posted Sep 06, 2004 19:21:00

0

Hi Leandro,

Thanks for the prompt reply. Maybe I should have posted my question this way. Can the above mentioned problem be solved in a more Object Oriented way?

For example we have a Person class that has the attributes pertaining to each individual as such: -

Such method allows me to first populate the business objects inside MyFormBean and then display the information to my JSP. However after capturing the user entered data, the MyFormBean captured in the submitted request does not feature newly entered data.

I was wondering if there is any way to capture the newly entered data WITHOUT hardcoding all the person attributes or use arrays.