struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sinclair, Mark" <msincl...@eds.com>
Subject Multiple updates to objects from a table list
Date Mon, 07 Jul 2003 11:40:05 GMT
Hi folks,

I have a question - however the root cause of the question may be because I
am not understanding the best way to use the Form Beans and the Actions for
updating multiple objects from one screen.

Basically I have a jsp that displays a table list of objects (ItemType).  I
pass an ItemTypes ArrayList to the jsp (in the session) and use a
logic:iterate to print out the HTML.  Each printed ItemType row also needs
to have a check box and a couple of text boxes to accept input if needed.  
Rather than use an edit hyperlink for each row to a separate screen -  if
the check box is checked for the row when the form is submitted (after
validation) it needs to read the values for the text boxes and update for
the relevant fields for the ItemType in the DB and repeat for all checked
rows.

Since I need to capture input I use text boxes, the property attribute needs
to be present so my jsp FormBean has properties e.g. rate and units that
will correspond to the values that need to be read?  So each time I output
the row in the iterate to draw the text box I use

<html:text property="units" styleClass="textControl" maxlength="8"/>

where units is an int in my FormBean.  (In my formBean units is not an array
- should it be?)

Also, I cannot seem to read the units array from the request in the validate
of the FormBean I have tried 

request.getParameter("units[1]");
request.getParameter("units(1)]"); both return null.

and several other variations.   Does anybody know the correct way to get at
the units text box array?

I am trying to get the basics working for now and then this will be expanded
to test if check box is checked then process each row together.
 
All other struts examples I have seen present a list then use a separate
screen to edit each row and return to the list with updated values.  I may
have several item on the list all needing rates and units entered and would
be much more user friendly to process at once.
So, more importantly is there a better way to construct this, this must have
been done many times before? - any examples would be much appreciated.

This is probably as clear as mud but thanks in advance,
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message