Search code examples
javascriptjqueryajaxjspstruts-1

Dropdown based on another dropdown in jsp Struts


I'm very new to Ajax. Currently I'm working on a new project. For that project one of the requirements is, populating a second dropdown based on the input from the first dropdown. I'm using Struts to do that. I don't want the page to be refreshed, so I need to use Ajax for calling the second dropdown content in the backend and populate in the second dropdown. I don't know how to write code for that.

What should be included (jars,tags) in my struts project? What entries should come in my JSP (I am using <html:select>)? What will come in JavaScript? What will come in action class (in action class I can fetch the list values from the DB based on the selection from the first dropdown)?


Solution

  • Instead of ajax, I used struts only to acheive this. I have assigned all variables to form to keep values when submitting form.