You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shyam A <st...@yahoo.com> on 2004/02/05 16:43:37 UTC

Array of text fields generated dynamically

Hi,

I have a scenario in my Struts application, where I
have an array of text fields grouped by category on a
JSP, and these are generated dynamically.

eg.
Category A
text field 1
text field 2
text field 3

Category B
text field 1
text field 2

........


The issue here is how to handle the values of the text
fields in my form bean. What I plan to do is to have a
String array for the text fields, and also a
corresponding array of hidden fields, to identify the
category.

Is this the best way to handle this situation?

Any help/suggustions/pointers will be greatly
appreciated.

Thanks,
Shyam


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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


Re: Array of text fields generated dynamically

Posted by Hubert Rabago <ja...@yahoo.com>.
http://jakarta.apache.org/struts/faqs/indexedprops.html
http://www.developer.com/java/other/article.php/2233591

Also, 
http://marc.theaimsgroup.com/?l=struts-user&s=LazyList

- Hubert 

--- Shyam A <st...@yahoo.com> wrote:
> Hi,
> 
> I have a scenario in my Struts application, where I
> have an array of text fields grouped by category on a
> JSP, and these are generated dynamically.
> 
> eg.
> Category A
> text field 1
> text field 2
> text field 3
> 
> Category B
> text field 1
> text field 2
> 
> ........
> 
> 
> The issue here is how to handle the values of the text
> fields in my form bean. What I plan to do is to have a
> String array for the text fields, and also a
> corresponding array of hidden fields, to identify the
> category.
> 
> Is this the best way to handle this situation?
> 
> Any help/suggustions/pointers will be greatly
> appreciated.
> 
> Thanks,
> Shyam
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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


Re: Array of text fields generated dynamically - validation problem

Posted by Nafise Dianatizade <n_...@yahoo.com>.
I have problem with array validation too, I can print the propety values in my action, but the validation doesn't work when I'm working with array type(ex. String[]). The validation of  "required" rule returns no error when it's empty.
 
Is there any special configuration for validating properties of type array?
 
Thank you
Nafise


---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

Re: Array of text fields generated dynamically - validation problem

Posted by Shyam A <st...@yahoo.com>.
Hi,

I use a String[] in my form bean to handle a dynamic
array of text fields.

In my ActionForm, I have

private String[] candList;

public String[] getCandList()
{
return candList;
}

public void setCandList(String[] aCandList)
{
candList = aCandList;
}

----------------------------

In my JSP, I use
				
<html:text property="candList" size="25"
maxlength="25"/> 

within a <logic:iterate> tag.

My problem is that when a validation error occurs in
the validate() method of my form bean, the text fields
are populated with junk values. The text fields do not
retain the user entered values. However, the user
entered values can be printed out in the validate()
method.

How do I work around this problem?

Any help, suggestions/pointers will be greatly
appreciated.

Thanks,
Shyam



--- Shyam A <st...@yahoo.com> wrote:
> Hi,
> 
> I have a scenario in my Struts application, where I
> have an array of text fields grouped by category on
> a
> JSP, and these are generated dynamically.
> 
> eg.
> Category A
> text field 1
> text field 2
> text field 3
> 
> Category B
> text field 1
> text field 2
> 
> ........
> 
> 
> The issue here is how to handle the values of the
> text
> fields in my form bean. What I plan to do is to have
> a
> String array for the text fields, and also a
> corresponding array of hidden fields, to identify
> the
> category.
> 
> Is this the best way to handle this situation?
> 
> Any help/suggustions/pointers will be greatly
> appreciated.
> 
> Thanks,
> Shyam
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing
> online.
> http://taxes.yahoo.com/filing.html
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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