Subject: Re: Form with iterative input fields HELP
From: Vic Cekvenich <[EMAIL PROTECTED]>
 ===
Why do you say it is not ideal? Master detail processing is done all the 
time. I think it is ideal and ... simple.

Create a form bean that contains another form bean (master and detail 
inside it). Make your beans implement iterator interface (see my sample 
app to see iterator interface implemented at basebeans.com).
Call bean.populate()in action, that uses DAO to retrieve, and also asks 
the "inner" bean to populate. (again I use disconnected row set inside 
the dao (with any valid SQL string), avoiding steps to collection or 
value object)

In JSP display master fields and iterate the detail records.
Updates work with mutiple detail records just fine with Struts 1.1, 
automatically, you do .... almost nothing. Just used index property in 
the tag, and the setter will by itself iterate. (OT note to stuts-dev: 
once  standard tags are in use for logic ... they have to interact with 
form beans HTML tag in similar fashion)
Validation has a small bug for multi row validation (the "fix" should be 
comited to dev list by end of week and therafter find itself maybe it a 
later build) but I could get it you the code by next Monday.
For insert, make sure you set the FK in action.

Actually, typical forms have several one to many and many to many 
relationships on each page. This is just realistic. It may take a bit to 
learn, but Struts is wonderful after you get over the hump.
The sample app does master detail, but not on same page, because it is a 
"training" app. I will fix it up soon to show multi row validation and 
multi row CRUD.
Anyway, students in my class do this as a lab, among 15 other labs. 
(like dynamic client side options in Stuts)


Vic

ps: You can get multi row master detail to work in EJB.... but it would 
be non scalable, and in production.... you would remove the EJB layer.

> I have a single form with both master and detail entry on the same form.  At
> the top of the form are the master input fields and at the bottom is a
> "list" of 0 or more groups of input fields for the details associated with
> it.
> 
> I know this not an ideal situation, but it is what the users want.
> 
> Can I use the Form bean to both display and validate the data on this form?
> If so, how do I deal with the indexed values?
> 
> 



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

Reply via email to