SSM与jsp传递实体类

jsp传controller

Controller:

@RequestMapping({"/user"})
public void registerUser(User uu)
throws Exception
{
System.out.println(uu.getPhone());
}

jsp:

<form>

<input id="reg_username" name="phone" type="text" class="form-control" placeholder="手机号" datatype="m" errormsg="请输入手机号"/>

</form>

实体类:

public class User {
private String phone;//

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

}

controller传jsp

controller传对像,jsp页面用对象.属性接收

原文地址:https://www.cnblogs.com/yanan7890/p/8137179.html