zoukankan      html  css  js  c++  java
  • 每天学点SpringMVC-视图部分

    1.  视图解析流程

         1.1  SpringMVC会将目标方法返回的String、Model或其他数据类型转换为ModelAndView

         1.2  SpringMVC通过ViewResolver将ModelAndView转换转换成物理视图View

         1.3 SpringMVC通过View的render方法进行渲染

         1.4 InternalSourceView是比较常见的视图,InternalSourceViewResolver则是为了进行转换前者,该View的渲染方式是通过forword  JSP实现

    2. 若项目中使用了JSTL,springmvc会自动把InternalResourceView转换成JstlView

    3. <mvc:view-controller>能够配置直接转发的页面

    4. 自定义视图的步骤

        4.1  自定义View并实现接口View,需要添加@Component注解使其变为Spring容器的组件

       4.2  在spring-mvc配置文件中配置 BeanNameResolver(根据名称生成视图View)

    5. 以"redirect:"开头实现重定向功能

        以"forward:"开头实现转发功能

    6. 如果采用springmvc form产生一下错误:

     The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). 

      有可能是form中的path无法与pojo的属性一一对应导致!!!

    7. springmvc form默认需要一个key=command的域对象进行回显

    8. <mvc:default-servlet-handler/>标签解决静态资源无法映射的问题

  • 相关阅读:
    多线程
    python 面向对象
    selenium 安装 以及相关环境
    pyquery 库的方法
    Python 面向对象的补充
    python 面向对象
    想造轮子的时候,ctrl+f一下
    C#三层开发做学生管理系统
    C# 我是个传奇的 using
    啦啦啦 啦啦 啦 啦 啦 啦啦 啦 啦 啦
  • 原文地址:https://www.cnblogs.com/xpawn/p/7566597.html
Copyright © 2011-2022 走看看