2025年spring简单入门实例(spring入门经典)

spring简单入门实例(spring入门经典)lt xml version 1 0 encoding UTF 8 gt lt beans xmlns http www springframew org schema beans xmlns xsi http

大家好,我是讯享网,很高兴认识大家。

<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.2.xsd"> <!-- 扫描路径 --> <context:component-scan base-package="com.springmvc.controller" > <!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> --> </context:component-scan> <!-- 配置根视图 --> 

讯享网

<!– <mvc:view-controller path="/" view-name="index"/> –>

讯享网<!-- 激活基于注解的配置 @RequestMapping, @ExceptionHandler,数据绑定 ,@NumberFormat , @DateTimeFormat ,@Controller ,@Valid ,@RequestBody ,@ResponseBody等 --> <mvc:annotation-driven /> <!-- 静态资源处理, css, js, imgs --> <mvc:resources location="/assets/" mapping="/assets/"></mvc:resources> <!-- 配置JSP 显示ViewResolver--> 

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">


讯享网

<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/view/"/> <property name="suffix" value=".jsp"/> 

</bean>

</beans>

小讯
上一篇 2025-04-25 18:15
下一篇 2025-05-21 15:03

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/152159.html