You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <pu...@charter.net> on 2005/07/09 15:54:46 UTC

Nested Beans and Validation

Hello,

I have been using struts for a bit now, and I am trying to see if the following situation is possible.

In a merchant checkout situation, I would like to be able to create a bean that has nested beans inside. Eg: This will be a shopping cart checkout, and I have the need for an overall bean to keep track of which section they are on, as well as creating "Billing" and "Shipping" beans nested inside this bean.

I know from a programmatic side that this is possible, but the problem begins with validation and form presentation. Each page currently has a bean associated with the action, and on the receiving page I use the html:text, etc. tags, and I always have to make sure the proprties are in the bean. But when dealing with a bean with a nested bean I do not know how to call the html:element?
<html:text property="overallbean.nestedbean.property" />

And if I have one bean associated with many actions, and I have different validator.DynaValidatorForm objects, how do I validate nested beans?

In a overall scenario, I would like to be able to create one large bean associated with many actions and have the ability to use the html:elements and do validation all within the one large bean, validating and using nested bean elements?

I have googled around, but do not see anyways to accomplish this short of a wizard approach, which I am trying to avoid.

Thanks,
Scott