1、spring mvc自动将传入的pojo数据存入request域

request中的key是该pojo类名,首字母小写。

 

JSP

 spring mvc 数据回显

 

controller

 spring mvc 数据回显

 

 

 

第一次访问user.jsp

 spring mvc 数据回显

 

 

填写表单

 spring mvc 数据回显

 

点击提交后。

 spring mvc 数据回显

 

 

2、@ModelAttribute

a、可以制定spring mvc自动传入的pojo的可以。接上面例子,如下。

jsp

 spring mvc 数据回显

 

 

controller

 spring mvc 数据回显

 

 

 

b、将方法的返回值到request域

   在访问这个controller的mapping的时,会将@Mapping方法的返回值放在request域

 spring mvc 数据回显

 

以下的都成功回显了。

 spring mvc 数据回显

spring mvc 数据回显

spring mvc 数据回显

 

 

3.平常的回显(如model、request)

相关文章:

  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-02-09
  • 2021-12-14
  • 2021-05-20
猜你喜欢
  • 2021-08-06
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案