I have a form controller.Form element is a drop down box.
For eg there is user name form element.if user select his name .I want the children names to be loaded for particular user.
I have List getChildernByUser(User user);
Please would like to know how this can be made using jquery or ajax.开发者_运维技巧If user is selected in next form element he gets all his children to select .
In the server side, I'd use a controller method like this:
@RequestMapping("/users/{userId}/children")
public @ResponseBody List<User> getChilden(@PathVariable String userId) { ... }
More info in this kind of controller methods can be found in the Spring reference doc. You'll also need the Jackson libraries in your /lib
folder for Spring MVC to convert the bean to JSON.
Then, in your client code (HTML) you can use the getJSON() function to make an Ajax call and get a List of users in JSON format.
Good luck.
精彩评论