dynamic DropDwon list
i have a probelm:-
i need to bind DropDownList to something dynamic,i know that i should bind it to Option[ ] and the happened in the session bean, and init. this Option in the constructor to fixed data like newOpion("My choice","Mychoice);
but this is not my case, my case i have a webservice which returns a string after some operations on it i can exclude the string that i will put in the DropDownList
sooo how can i do this!!!!!!
[459 byte] By [
HoBaa] at [2007-11-27 8:11:03]

# 1
From my understanding create an option array from the string
generated by the webservice and bind it with the dropdown component.
The Option array might not be fixed as we can populate it either from a DB, xml or a Webservice
You can change the contents of the dropdown for every request, if the even if webservice is getting called once per request by making use of the requestbean1 object for binding
# 2
it's works with this way:-
i have create an Option[ ] and String[ ] in the SessionBean and bind the first one to the dropDownList and the second one to the selected property and in the pageload() i made this:-
com.sun.rave.web.ui.model.Option[] options=new com.sun.rave.web.ui.model.Option[usr.size()];
for(int i=0;i<options.length;i++){
options[i]=new com.sun.rave.web.ui.model.Option(usr.get(i).toString(), usr.get(i).toString());
}
getSessionBean1().setOptions(options);
so the dropDownList contains my data but i failed when i select any thing from the dropDownList why!!!!>
HoBaa at 2007-7-12 19:54:52 >

# 4
Hi,
I cannot understand what you mean by the term "failed", once you select something.
Are you setting the paramater "Autosubmit on change" or using a search button to submit
In either cases
1) Just bind the selected option of the combo to a private variable refractored in the SessionBean1 or any other instantiated classes from there.
2) May be the usr.size (if its dynamic for every request) is zero, so you are getting an empty combo.
Can you be more specific with the question if my aforementioned suggestions makes less sense.
Message was edited by:
TheCarribeanKid
# 5
This might help: http://developers.sun.com/jscreator/learning/tutorials/2/hibernate.html#option
> i have a probelm:-
>
> i need to bind DropDownList to something dynamic,i
> know that i should bind it to Option[ ] and the
> happened in the session bean, and init. this Option
> in the constructor to fixed data like newOpion("My
> choice","Mychoice);
> but this is not my case, my case i have a webservice
> which returns a string after some operations on it i
> can exclude the string that i will put in the
> DropDownList
> sooo how can i do this!!!!!!