struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: Multi-Select List Box
Date Sat, 01 Feb 2003 19:57:49 GMT
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 <guigar@ribera.tel.uva.es>
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: Struts Users Mailing List <struts-user@jakarta.apache.org>
>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
>guigar@ribera.tel.uva.es
>palmerabollo@hotmail.com
>                                         "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: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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