博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpringMVC配置
阅读量:4086 次
发布时间:2019-05-25

本文共 1598 字,大约阅读时间需要 5 分钟。

1.spring-servlet.xml spring的配置文件

2.web.xml中的配置:

Archetype Created Web Application
sprintMVC环境搭建
contextConfigLocation
classpath:/configs/applicationContext-client.xml
org.springframework.web.context.ContextLoaderListener
springUtf8Encoding
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
forceEncoding
true
springUtf8Encoding
/*
Dispatcher
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:configs/spring-servlet.xml
1
Dispatcher
/
index.jsp

3.使用

@Controllerpublic class LoginController {        @RequestMapping("/login.do")//当拦截到"/login.do"执行下面的函数    public String doLogin(HttpServletRequest request,HttpServletResponse response)    {                ModelAndView mv=new ModelAndView();//model对象        mv.addObject("arg0","hello,world!");//在model添加对象        request.setAttribute("mv", mv);//用request来传递modelandview对象        return "forward:/toShow";//跳转    }    }

转载地址:http://askii.baihongyu.com/

你可能感兴趣的文章
通过试题理解JavaScript
查看>>
webpack的面试题总结
查看>>
实践这一次,彻底搞懂浏览器缓存机制
查看>>
Koa2教程(常用中间件篇)
查看>>
React Hooks 完全指南
查看>>
React16常用api解析以及原理剖析
查看>>
教你发布你npm包
查看>>
nvm 和 nrm 的安装与使用
查看>>
React Hooks 一步到位
查看>>
React Redux常见问题总结
查看>>
前端 DSL 实践指南
查看>>
ReactNative: 自定义ReactNative API组件
查看>>
cookie
查看>>
总结vue知识体系之实用技巧
查看>>
PM2 入门
查看>>
掌握 TS 这些工具类型,让你开发事半功倍
查看>>
前端如何搭建一个成熟的脚手架
查看>>
Flutter ListView如何添加HeaderView和FooterView
查看>>
Flutter key
查看>>
Flutter 组件通信(父子、兄弟)
查看>>