Re: Multi-Select List Box
Define a String[] in your form bean with the same name as your select box. David From: Cohan, Sean [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: Multi-Select List Box Date: Sat, 1 Feb 2003 11:39:40 -0500 If I use a collection to create a multi-select html:select, how do I get the selected items back to my action class? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multi-Select List Box
Thanks. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 01, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: Re: Multi-Select List Box Define a String[] in your form bean with the same name as your select box. David From: Cohan, Sean [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Subject: Multi-Select List Box Date: Sat, 1 Feb 2003 11:39:40 -0500 If I use a collection to create a multi-select html:select, how do I get the selected items back to my action class? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - 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: Multi-Select List Box
Can anyone post a sample? I don't know how to set the indexed properties. If I do: public void setSelectBox(int index, String item) { selectBox[index] = item; } i can get a NullPointerException or an ArrayIndexOutOfBoundsExceptions because I don't know selectBox array size... What is the best practice to do it?? 1. Using a Collection (is not allowed in JavaBeans specification) 2. Increasing dynamically the array size in the setSelectBox method (maybe too tricky ?). Thank you very much. David Graham wrote: Define a String[] in your form bean with the same name as your select box. David Guido Garcia Bernardo [EMAIL PROTECTED] [EMAIL PROTECTED] stat rosa pristina nomine, nomina nuda tenemus. http://members.ud.com/services/teams/team.htm?id=D8624419-BFB6-4772-A01A-0045631F979F - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multi-Select List Box
Guido == Guido [EMAIL PROTECTED] writes: Guido Can anyone post a sample? I don't know how to set the indexed properties. Guido If I do: Guido public void setSelectBox(int index, String item) { GuidoselectBox[index] = item; Guido } Guido i can get a NullPointerException or an ArrayIndexOutOfBoundsExceptions Guido because I don't know selectBox array size... Guido What is the best practice to do it?? Guido 1. Using a Collection (is not allowed in JavaBeans specification) Guido 2. Increasing dynamically the array size in the setSelectBox method (maybe Guido too tricky ?). If you don't know for sure what the size will be, then don't use an array, use an ArrayList. I believe the ensureCapacity() method would be used to increase the size of the collection if the given index is larger than the current size (-1). -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP; SCWCD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multi-Select List Box
It should look like this: private String[] selectBox = null; public void setSelectBox(String[] selectBox){ this.selectBox = selectBox; } public String[] getSelectBox(){ return this.selectBox; } David From: Guido [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Multi-Select List Box Date: Sat, 1 Feb 2003 18:58:45 +0100 (MET) Can anyone post a sample? I don't know how to set the indexed properties. If I do: public void setSelectBox(int index, String item) { selectBox[index] = item; } i can get a NullPointerException or an ArrayIndexOutOfBoundsExceptions because I don't know selectBox array size... What is the best practice to do it?? 1. Using a Collection (is not allowed in JavaBeans specification) 2. Increasing dynamically the array size in the setSelectBox method (maybe too tricky ?). Thank you very much. David Graham wrote: Define a String[] in your form bean with the same name as your select box. David Guido Garcia Bernardo [EMAIL PROTECTED] [EMAIL PROTECTED] stat rosa pristina nomine, nomina nuda tenemus. http://members.ud.com/services/teams/team.htm?id=D8624419-BFB6-4772-A01A-0045631F979F - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]