package com.loger.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class RequestParam {
public static final String SUCCESS = "success";
@RequestMapping(value="/requestparam")
public String requestParam(@org.springframework.web.bind.annotation.
RequestParam(value="username") String un,
@org.springframework.web.bind.annotation.RequestParam(value="age") Integer age){
System.out.println(un + " " + age);
return SUCCESS;
}
}
package com.loger.bean;
public class Address {
private String province;
private String city;
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
@Override
public String toString() {
return "Address [province=" + province + ", city=" + city + "]";
}
}
package com.loger.bean;
public class User {
private String name;
private int age;
private Address address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
@Override
public String toString() {
return "User [name=" + name + ", age=" + age + ", address=" + address + "]";
}
}
<form action="pojoparam">
姓名:<input type="text" name="name"><br>
年龄:<input type="text" name="age"><br>
城市:<input type="text" name="address.city"><br>
省份:<input type="text" name="address.province"><br>
<input type="submit" value="提交"><br>
</form>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有