Alexx
Alexx

Reputation: 311

Cascaded comboboxes in a Jsp with data form a DB. How do i do that?

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.

Upvotes: 1

Views: 1563

Answers (2)

рüффп
рüффп

Reputation: 5448

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

Upvotes: 1

dbyuvaraj
dbyuvaraj

Reputation: 505

Would you like to use jsp, servlets only? Because you can do it easily by any of java frameworks like struts2 with ajax call

Upvotes: 1

Related Questions