spingmvc 配置springmvc-servlet.xml失效500报错
Line 12 in XML document from class path resource [springmvc-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 8; 2 瀛楄妭鐨� UTF-8 搴忓垪鐨勫瓧鑺� 2 鏃犳晥銆�
大概是这个
主要解决方法:
jdk换成1.8 tomcat 中的jre也换成相应版本
大多数情况是由于spingmvc-servlet.xml问题在判断你本身xml文件没有结构化错误的情况
我的xml现在是这个
<?xml version="1.0" encoding="GB2312"?>
<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"
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">
<!-- 自动扫描包,让包指定下的注解生效,由ioc容器统一管理-->
<context:component-scan base-package="com.monan.controller"/>
<!-- 让spring mvc 不处理静态资源-->
<mvc:default-servlet-handler/>
<!--
支持mvc注解驱动
在spring中一般采用@requestmapping 注解来完成映射关系
要想使@requestmapping 注解生效
必须向上下文中注册defaultannotationhandlermapping
和一个annotationmethodhandleradapter实例
这两个实例分别在类级别和方法级别处理
而annotation-driven 配置帮助我们自动完成上述两个实例的注入
-->
<mvc:annotation-driven/>
<!-- 视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
id="internalResourceViewResolver">
<!-- 前缀-->
<property name="prefix" value="/WEB-INF/jsp/"/>
<!-- 后缀-->
<property name="suffix" value=".jsp"/>
</bean>
</beans>
可以看到我的encoding发生了改变

因为起初的我就是utf-8,然后跑不通,idea 里面tomcat启动直接报错
当换成了之后就不报错了,
然后页面也不会出现500服务器内部出现错误的问题