发布于2022-01-08 22:21 阅读(1121) 评论(0) 点赞(15) 收藏(4)
我在我的注册页面中应用了 spring 验证。但是我的应用引擎服务器的服务器日志中显示了以下错误。
javax.servlet.UnavailableException:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 22 in XML document from ServletContext resource
[/WEB-INF/spring/appServlet/servlet-context.xml] is invalid;
nested exception is org.xml.sax.SAXParseException;
lineNumber: 22; columnNumber: 30;
cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'property'.
我的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd >
<beans:bean name="/register" class="com.my.registration.NewUserRegistration">
<property name="validator">
<bean class="com.my.validation.UserValidator" />
</property>
<beans:property name="formView" value="newuser"></beans:property>
<beans:property name="successView" value="home"></beans:property>
</beans:bean>
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
</beans:beans>
您文档的默认 XML 命名空间是http://www.springframework.org/schema/mvc
,因此您应该为来自其他命名空间的所有元素使用命名空间前缀,包括来自http://www.springframework.org/schema/beans
命名空间的元素:
<beans:property name="validator">
<beans:bean class="com.my.validation.UserValidator" />
</beans:property>
或者,您可以配置http://www.springframework.org/schema/beans
为默认命名空间:
xmlns = "http://www.springframework.org/schema/beans"
显然,在这种情况下,您需要为命名空间中的元素使用命名空间前缀mvc
(如果有的话)。
也可以看看:
作者:黑洞官方问答小能手
链接:http://www.javaheidong.com/blog/article/375976/7edb7e2c34c839a1b853/
来源:java黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 java黑洞网 All Rights Reserved 版权所有,并保留所有权利。京ICP备18063182号-2
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!