配置SpringMVC,报错:c
配置SpringMVC,报错:c
1、springmvc.xml文件中报错详情
Multiple annotations found at this line:
- cvc-attribute.3: The value '/hello' of attribute 'id' on element 'bean' is not valid with respect
to its type, 'ID'.
- cvc-datatype-valid.1.2.1: '/hello' is not a valid value for 'NCName'.
2、报错语句
<bean id="/hello" class="com.kuang.controller.HelloController"/>
3、springmvc.xml配置文件内容
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="" xmlns="" xsi:schemaLocation=" .0.xsd"> <!-- 先在springmvc.xml配置文件中添加处理器映射器 --><bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" /><!-- 添加处理器适配器 --><bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /><!-- 配置视图解析器:把handler处理类的返回值,加工成最终的视图路径--><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="InternalResourceViewResolver"><!-- 前缀 --><property name="prefix" value="/WEB-INF/jsp"></property><!-- 后缀 --><property name="suffix" value=".jsp"></property></bean> <!-- Handler --><bean id="/hello" class="com.kuang.controller.HelloController"/> </beans>
4、解决方法
报错的代码没有写错,出错的地方在于xml文件的版本,将.0.xsd"> 改为
/spring-beans.xsd"> 即可。
最新文章
- platform创建说明
- VMware虚拟机使用Ubuntu全屏问题
- Linux中mysql的重启
- ViewDragHelper实战,实现滑动解锁
- IIS服务器的安全保护措施
- TextOut字体设置
- 夜听崔健
- 高通Linux Android 平台中的蓝牙功能学习 (4)
- void* 指针有什么用
- VC知识库的一篇文章
- Hashtable用法
- SiamFC:用于目标跟踪的全卷积孪生网络 fully
- 51nod:1079 中国剩余定理(数学)
- mysql upsert语法
- 微信小程序实现一个简单的倒计时效果
- tomcat守护进程
- Qt SQL:QSqlField、QSqlRecord、QSqlIndex、QSqlError