属性p:此处不允许使用前缀

时间:2013-12-15 17:58:06

标签: xml spring spring-mvc

我使用spring mvc和我的dispatcherServlet.xml文件

创建了一个项目
<bean id="jspViewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/views/"
          p:suffix=".jsp"
            />

p:prefixp:suffix是不允许的。我该如何解决这个问题?我使用过SpringVersion 3.2.3.RELEASE

2 个答案:

答案 0 :(得分:4)

您需要添加p命名空间声明:xmlns:p="http://www.springframework.org/schema/p"

<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">

请参阅Spring参考:Chapter 5.4.2.6 XML shortcut with the p-namespace

答案 1 :(得分:-2)

  

&#13;
&#13;
<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:util="http://www.springframework.org/schema/util"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
	   					   http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
	   					   http://www.springframework.org/schema/context
       					   http://www.springframework.org/schema/context/spring-context-4.1.xsd	
       					   http://www.springframework.org/schema/util 
       					   http://www.springframework.org/schema/util/spring-util-4.1.xsd   					   
	   					   ">
&#13;
&#13;
&#13;