标签:
<form action="/springmvc1/user/add" method="post"> id: <input type="text" name="id"><br> 姓名:<input type="text" name="name"/><br> 密码:<input type="text" name="password"/><br> 地址:<input type="text" name="address"/><br> <input type="submit"/> </form>
public class User { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
@RequestMapping(value="add", method=RequestMethod.POST, produces="text/html;charset=UTF-8") @ResponseBody public String addUser2(User user,String password, String address){ //return request.getParameter("username")+request.getParameter("password")+request.getParameter("address"); return user.getName()+user.getId()+password+address; }
标签:
原文地址:http://www.cnblogs.com/hpustudent/p/4319000.html