ModelAndView中Model和View的解释

在stackoverflow中看到一个很不错的解释,我先把原文粘到这里,下边我再翻译一下。

Here in this case, we are having 3 parameter's in the Method namely ModelandView. 
According to this question, the first parameter is easily understood. It represents the View which will be displayed to the client.
The other two parameters are just like The Pointer and The Holder
Hence you can sum it up like this 

ModelAndView(View, Pointer, Holder);

The Pointer just points the information in the The Holder

When the Controller binds the View with this information, then in the said process, you can use The Pointer in the JSP page to access the information stored in The Holder to display that respected information to the client. 
Here is the visual depiction of the respected process.

翻译

View

View的解释比较简单,它包含了一个路径。比如View的值是Welcome,就意味着urlPatternsWelcome的文件要被访问了。这个地方可以是servlet,也可以是JSP文件。

Model

Model的理解是我要记录这篇博客的关键。Model的参数分为PointerHolder,当ViewEngine被调用的时候,你可以拿着Pointer去JSP文件中寻找Holder所存储的信息,然后再把这个信息交给ViewEngine去呈现在页面上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值