SpringMVC的配置文件说明
2024-10-08 17:50:08
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- 注解 <context:component-scan> --> <!-- 启动扫描器 扫描base-package="" 这个包里面的bean 就可以省略 <bean id="" class="" /> 这个写法 同时bean 需要注解 注解的类型有 controller 、service 、repository 、component --> <context:component-scan base-package="com"/> <!--handlerMapping 就是处理器映射,可以将web请求映射到正确的处理器--> <bean id= "halderMapping" class="" > <property name="mappings"> <props> <prop name="/login.do">login</prop> <props> </property> </bean> <!--对应上面的 login.do 的value值--> <bean id="login" class=""> <!--mvc扫描,有了它就可以不用写上面的处理器映射 同时 controller组件的方法上面要加上 注解 @RequestMapping("/login.do") 处理login.do请求路径的方法 @RequestParam("username") 指定传入的web里面 name="username"参数 --> <mvc:annotation-driven></mvc:annotation-driven>
<!-- 定义视图解析器 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 前缀和后缀
<property name="prefix" value="/WEB-INF"></property>
<property name="suffix" value=".jsp"></property>
-->
</bean>
</beans>
最新文章
- java的各种使用小知识点总结。
- 详解Bootstrap网格系统
- [Flex] PopUpButton系列 —— 将DataGrid作为弹出内容
- [转]Best way to sort a DropDownList in MVC3 / Razor using helper method
- Windows Phone开发(41):漫谈关键帧动画之下篇
- Learning JavaScript(0)_Concepts
- hibernate 多对多关系总结
- overridePendingTransition介绍
- 前端之JavaScript--基础
- Python CRM项目七
- java.lang.ClassCastException: net.sf.json.JSONNull cannot be cast to net.sf.json.JSONObject的解决方法
- CLR 无法从 COM 上下文 0x208f68 转换为 COM 上下文 0x2090d8,这种状态已持续 60 秒
- 第十二章 Java内存模型与线程
- Idea 调试快捷键
- 多浏览器播放wav格式的音频文件
- C++ 经典知识点面试题
- Mac上的jdk
- .Net Core:身份认证组件
- 【Java】Java-XML解析利器-SAX-高性能-易用
- iOS APP版本更新跳转到App Store下载/更新方法
热门文章
- hue中访问impala报错
- Dubbo的配置过程,实现原理及架构详解
- Day6 - K - 陌上花开 HYSBZ - 3262
- leetcode617 Merge Two Binary Trees
- Js获取页面地址参数
- HYSBZ - 1588 营业额统计 (伸展树)
- java简写名词解释
- 127个常用的JS代码片段,每段代码花30秒就能看懂(上)
- 浅谈Python 中 __getattr__与__getattribute__的区别
- hdu 4300 Clairewd’s message 字符串哈希