Hy.What i am trying to do is preety simple (as logic) but i just can`t figure out how to do it. I am making a project using classic MCV with servlets and jsp and i am getting data from a Data Base.I have a library with books and authors and what i am trying to do is to make 2 comboboxes , the first one containing the author names, and after i select one of the author names , in the second combobox to show me all the book written by that author and select one book. I found something in javascript the link :
first combo example and
second combo example and
third combo example
i would like something like that to do ,but in those examples the data is already there , i need to call a method from a java bean , that returns a list of Authors and i want the author name to be inside the combo list.
It's easy to do in swing because you can have action listeners on a combobox , and you can get the selected index but here I have no idea how to do this.
If someone has any ideas on how to do this , not neccesarely to be done in java script, or using servlet actions , or another way to select the books easily ... I would apreciate it .
thx alot.
Asked
Active
Viewed 1,557 times
1

Alexx
- 311
- 2
- 8
- 19
-
... sounds like 2 step process... 1 get authors... 2 get the books... the 2nd one could be done with an Ajax call if you wan to keep the user on the same page etc. – vector Apr 08 '11 at 22:37
-
1possible duplicate of [Populating child dropdownlists in JSP/Servlet](http://stackoverflow.com/questions/2263996/populating-child-dropdownlists-in-jsp-servlet) – BalusC Apr 08 '11 at 23:08
2 Answers
1
Would you like to use jsp, servlets only? Because you can do it easily by any of java frameworks like struts2 with ajax call

dbyuvaraj
- 487
- 1
- 6
- 20
-
how is it different ? because to render i use jstl.struts 2 suports other calls ? – Alexx May 04 '11 at 11:47
1
Personnally I would use DWR for that kind of problematic.
http://directwebremoting.org/dwr/index.html
I like JQuery as well, but i prefer DWR for doing the ajax calls and keep the jquery for pure client processing / beautify the GUI with jquery components.
DWR integrates with many java technologies (jsp, struts, spring, hibernate, jsf). I really like it and it is very simple to start to work with (very short learning curve).

рüффп
- 5,172
- 34
- 67
- 113