views:

172

answers:

1

I've seen a few questions like this, but mine is a bit more specific so I hope this isn't considered a repost.

I am working on a website that is built with struts 2 and hibernate. I need to dynamically populate a drop down menu using data from a sql query based on an option selected in another drop down menu.

So basically when the first option is selected I need to rehit the server and get the results from a query like

SELECT column FROM table WHERE option = dropDownOption

On top of that, I would really like to use ajax to only refresh the affected elements, however I'm really unfamiliar with ajax. I have jquery on this project and I found they have some ajax built in, but is this a good method for using it? any advice on this topic would be appreciated.

+1  A: 

Nothing really specific here, just the standard cascading dropdown-select lists. (jQuery is the most popular way nowadays, specially if you want to go the Ajax way, hiting the server. Tons of tutorials in the web).

What matters from the designer point of view is that the web server is rehit. Whether this implies a rehit to the DB does not matter to the web layer (Struts2 action or whatever), who only should need to ask the business layer for the items "WHERE option = dropDownOption"; perhaps they are permanently loaded in memory, perhaps they are cached, perhaps they are loaded from the DB - it should not matter at all.

leonbloy
Thanks for the advice!
Shaded