开发者

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 a开发者_如何学编程uthor 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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜