how to pass multiple selected values from list box to bean
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   pat_pat
Posted On:   Saturday, December 28, 2002 05:46 PM

Any example code for multiple selected values from the list box to bean: I have my form like: some description 1 some description 2 some description 3 some description 4 some description 5 Submit in bean i have getter & setter methods: now , how can i pass one or more selected values from the list box to the bean and i have a query like: strQuery = " select * from propery where propertyID IN(getPropertyID(), getPropertyID(), getPropertyID(),getPropertyID() , getPropertyID())" something like: select * from property where propertyid IN(2,4,5,9); now i have one getPropertyID() & setPr   More>>

Any example code for multiple selected values from the list box to bean:

I have my form like:




Submit



in bean i have getter & setter methods:

now , how can i pass one or more selected values from the list box to the bean

and i have a query like:

strQuery = " select * from propery where propertyID IN(getPropertyID(), getPropertyID(), getPropertyID(),getPropertyID() , getPropertyID())"
something like:

select * from property where propertyid IN(2,4,5,9);

now i have one getPropertyID() & setPropertyID() methods
how it is possible to pass same variable to pass the multple values to the bean ?
Any sample code or example, greatly appreicated.
Thanks in advance.    <<Less

Re: how to pass multiple selected values from list box to bean

Posted By:   Vishal_Salian  
Posted On:   Thursday, January 2, 2003 03:47 AM

Your getter and setter methods should be as below .For multiple selection the value is returned as an array .



public void setPropertyID(String value[]) {
this.value = value;
}



public String[] getPropertyID() {
return this.value;
}



Once you have the value as an array , you can write a logic to creat a list of comma seperated values and pass it to you SQL Query.


Hope this helps.

About | Sitemap | Contact