RE: Logic:iterate and html:text problem

2004-01-19 Thread Shishir K. Singh
Well, 


a) I have not used logic:iterate for these purpose, hence won't be able
to help you out much there. I use the JSTL tags and try to keep away
from the struts tag as much as possible.
b) I would use ArrayList instead of Vectors.


What I would do if I were you would be something like this: 
















I have added the table just for clarity. 

You may want to put a check for empty or null collection doing either
 In case you already have this
bean 
Or having another method like getSize() or something like that. 

Assuming that you have set and set methods on each one of the above
three parameters in your MultipleIdData bean. 

Try this and see if the vales get populated in the Collection when you
get it in your Action from the form.

This may contain some errors but should get you started :)

-Original Message-
From: Anna Yates [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 19, 2004 11:21 PM
To: [EMAIL PROTECTED]
Subject: Logic:iterate and html:text problem

I have multiple text boxes that I display on my page. Basically, I must
show n rows (2 text boxes per row). I have no problem displaying them,
but I am unclear on how to get the data back in a concise manner. To
display, I use logic:iterate (see below):


logic:iterate name="custAcctForm" id="multiple" property="multipleIds"

bean:write property="profileName" name="multipleIds"

html:text property="userName" name="multipleIds"

html:text property="password" name="multipleIds"



In my form I have a Vector defined, private Vector multipleIds; The
Vector holds a collection of my class, MultipleIdData which has 3 member
variables: 
profileName, userName, and password. When I use the code above, it
displays correctly, but the entered data goes nowhere. I have tried to
define the "id" property to the "multipleIds" value, but it gives me an
error that no collection was found. I was thinking I could index the
values, but am unclear if this is the road I should take.  I have seen
that if I initialize the Vector to some initial capacity, this will
work, but I don't know how large this Vector will be. Does anyone have
any suggestions. Thanks.

_
Check out the coupons and bargains on MSN Offers! 
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


-
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]



RE: Logic:iterate and html:text problem

2004-01-19 Thread Andrew Hill

but I don't know how large this Vector will be


One trick is to submit the size back in a hidden field. In the forms reset()
method, you can use request.getParameter() (unless its a multipart form!) to
get the size and initialise the vector before the form is populated from the
request.

Id suggest however that since you have two two fields per row you may as
well use nested form beans for each row rather than vectors for each column.
(Also makes it much more convienient to add a third++ column later on if you
need to.)

There is a good tutorial on this at the keyboard monkey site:
http://www.keyboardmonkey.com/next/index.jsp

hth
Andrew

-Original Message-
From: Anna Yates [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 20 January 2004 12:21
To: [EMAIL PROTECTED]
Subject: Logic:iterate and html:text problem


I have multiple text boxes that I display on my page. Basically, I must show
n rows (2 text boxes per row). I have no problem displaying them, but I am
unclear on how to get the data back in a concise manner. To display, I use
logic:iterate (see below):


logic:iterate name="custAcctForm" id="multiple" property="multipleIds"

bean:write property="profileName" name="multipleIds"

html:text property="userName" name="multipleIds"

html:text property="password" name="multipleIds"



In my form I have a Vector defined, private Vector multipleIds; The Vector
holds a collection of my class, MultipleIdData which has 3 member variables:
profileName, userName, and password. When I use the code above, it displays
correctly, but the entered data goes nowhere. I have tried to define the
"id" property to the "multipleIds" value, but it gives me an error that no
collection was found. I was thinking I could index the values, but am
unclear if this is the road I should take.  I have seen that if I initialize
the Vector to some initial capacity, this will work, but I don't know how
large this Vector will be. Does anyone have any suggestions. Thanks.

_
Check out the coupons and bargains on MSN Offers!
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


-
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]



Logic:iterate and html:text problem

2004-01-19 Thread Anna Yates
I have multiple text boxes that I display on my page. Basically, I must show 
n rows (2 text boxes per row). I have no problem displaying them, but I am 
unclear on how to get the data back in a concise manner. To display, I use 
logic:iterate (see below):

logic:iterate name="custAcctForm" id="multiple" property="multipleIds"

bean:write property="profileName" name="multipleIds"

html:text property="userName" name="multipleIds"

html:text property="password" name="multipleIds"



In my form I have a Vector defined, private Vector multipleIds; The Vector 
holds a collection of my class, MultipleIdData which has 3 member variables: 
profileName, userName, and password. When I use the code above, it displays 
correctly, but the entered data goes nowhere. I have tried to define the 
"id" property to the "multipleIds" value, but it gives me an error that no 
collection was found. I was thinking I could index the values, but am 
unclear if this is the road I should take.  I have seen that if I initialize 
the Vector to some initial capacity, this will work, but I don't know how 
large this Vector will be. Does anyone have any suggestions. Thanks.

_
Check out the coupons and bargains on MSN Offers! 
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418

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