Xml 属性p:此处不允许使用前缀
我已经用SpringMVC在我的Xml 属性p:此处不允许使用前缀,xml,spring,spring-mvc,Xml,Spring,Spring Mvc,我已经用SpringMVC在我的dispatcherServlet.xml文件中创建了一个项目 <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/views/" p:suffix=".jsp" /> 不允许使
dispatcherServlet.xml
文件中创建了一个项目
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/views/"
p:suffix=".jsp"
/>
不允许使用
p:prefix
和p:suffix
。我如何解决这个问题?我使用了SpringVersion3.2.3.RELEASE
您需要添加p-namespace声明:xmlns:p=”http://www.springframework.org/schema/p“
参见Spring参考:
xmlns:p=它已经被添加,我发现了这个链接[也无法解决。这是为什么?我遇到了相同的问题。xmlns:p=springframework.org/schema/p已经添加。您如何解决您的问题?您应该解释您的答案如何解决问题,即您需要将spring框架名称空间添加到xml beans定义文件的顶部。特别是您需要的部分是xmlns:p="http://www.springframework.org/schema/p“
。请注意,没有什么要求您使用p:。它们只是按照约定使用。您可以重写XML以使用:everywhere,只要它们被定义为映射到相同的XML命名空间。(这就是为什么需要定义它们。)
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">