I have a two drop downs(form:select) in a single form in a .jsp file and I wanted to populate the second drop down based on the selection of the first, however the problem is I cannot submit the form since I already have a controller mapping which saves the form values to DB. I know this can be done using AJAX(though I am not familiar with AJAX that much, I am more into back-end development). So I would like to find a solution without using AJAX for the time being. Any pointers to where to start is greatly appreciated though this might sound like a silly question.
Update corresponding to reply I got from Danny,
I think I have problem with suggested approach though,
"On the client side use JQuery which request data from your Spring MVC controller using POST:"
The problem is I already have a form submit controller mapping(POST) lets say something like /saveUser.htm )
I'll explain my problem using a example perhaps.
here I have two drop downs country and province,
<form:select path="country" cssClass="dropdown" >
<form:select path="province" cssClass="dropdown" >
If the user chooses particular country then provinces of the particular country should be loaded to second dropdown.
So, if I change first dropdown(country) to submit form onChange,
<form:select path="country" cssClass="dropdown" onchange="document.forms['userForm'].submit();">
the controller mapping get invoked would be
@RequestMapping(value = "/saveUser.htm" method=RequestMethod.POST)
public void saveUser(....)
not the
@RequestMapping(value = "/getOptions" method=RequestMethod.POST)
@ResponseBody
public String getOptionds(HttpServletResponse response)
though.
Regards, Carl