I'm developing an application in JSP using SimpleFormController
with Spring MVC 3.0.2 using Hibernate. Everything is fine. I'm also using Validator
to validate forms on the server side. It's also going on well.
Now, I need to use Ajax as an example, when a country is selected from a drop down (<form:select><form:option></form:option></form:select>
), the states corresponding to that country should be populated from the database in the state drop down.
I have done such things using Ajax in places but yet not with Spring MVC. I have gone through many tutorials/articles about SimpleFormController
on Google but none of them were using Ajax. I couldn't find a single idea about how to use Ajax with SimpleFormController
.
With annotated controllers (@Controller
), the thing can be made easy because methods can be mapped using the @RequestMapping
annotation (nevertheless I haven't yet used it but I think I can).
But with SimpleFormController
, I don't have any precise idea about how to handle Ajax requests in the Spring controller (which methods to be mapped and how). With SimpleFormController
, I'm usually associated with the onSubmit()
, showForm()
and referenceData()
methods.
Could you please expose some thoughts on how can an Ajax request be made on SimpleFormController
, which methods can be mapped and how? (I don't want the full code anymore. A very simple example (if and only if it's possible) or furthermore specific links where the use of Ajax with the SimpleFormController
is explained would be quite enough for me to study).