- 
            
            Controller:调用业务逻辑生产模型数据 查看全部
- 
            
            请求-->Front Controller-->具体的controller 查看全部
- 
            
            binding:jsp中标签的name属性应当和模型对象model中的Course属性名称一致 查看全部
- 
            
            @Controller 用于标记在一个类上,使用它标记的类就是一个SpringMVC Controller 对象。 查看全部
- 
            
            通过model传的值。model.addAttribute(course)可以类比成request.setAttribute("course", course),model将request做了一层包装,处理就交给了框架。 查看全部
- 
            
            Spring MVC 数据处理流程: request -> DispatcherServlet -> 加载 HandlerMapping,返回一个带有拦截器、处理器、ViewResolver的HandlerExecutionChain -> 执行拦截器和处理器 -> 返回 ModelAndView -> 将返回的 ModelAndView 交给 ViewResolver -> 渲染页面 <- response 查看全部
- 
            
            Spring MVC 核心思想 查看全部
- 
            
            在 Controller 中定义返回数据是 JSON 的方式有: 1、在【返回值类型】或【方法】上定义注解:@ResponseBody 2、返回值用 ResponseEntity 包装 查看全部
- 
            
            在 Spring MVC 中启用对 JSON 的支持,需要定义 bean:ContentNegotiatingViewResolver 常用参数: 参数:order:序号 参数:mediaTypes:Map 数据结构 json->application/json xml->application/xml htm->text/html 参数:defaultViews:List 数据 // JSON View 如: <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/> 参数:ignoreAcceptHeader:true/false 【注意】 1、可以配置多个 *ViewResolver,使用 order 排序,同时非 json 开发中配置的 InternalResourceViewResolver 要放在最后 2、MappingJackson2JsonView 依赖: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version></version> </dependency> 这个包还依赖:jackson-annotations、jackson-core 包 查看全部
- 
            
            处理文件上传的 @RequestMapping 方法需要定义一个参数 MultipartFile,这个参数有些获取用户上传文件基本信息的方法,如: public String upload( // 定义来自表单字段 name="file" 的元素 @RequestParam("file") MultipartFile file ) { // handle upload file code ... } isEmpty(); 是否是空文件 getName(); getOriginalFilename(); 用户原始文件名 getSize(); 上传文件大小 getInputStream(); 获取上传流 (and so on ……) 查看全部
- 
            
            文件上传需要定义 bean:CommonsMulitipartResolver CommonsMulitipartResolver: 参数:maxUploadSize:最大上传大小,单位 b 参数:defaultEncoding:字符编码 参数:resolveLazily:是否懒加载 前缀 Commons- 代表它实现自 commons-fileupload,commons-fileupload 又依赖 commons-io 查看全部
- 
            
              spring MVC 查看全部
- 
            
            MVC基本概念  查看全部 查看全部
- 
            
            M = model V = view C= controller 查看全部
- 
            
            mvc 框架  查看全部 查看全部
举报
 
             
         
                 
                 
                