xml配置錯誤
cvc-id.3: A field of identity constraint 'web-common-filter-name-uniqueness' matched element 'web-app', but this element does not have a simple type.出現(xiàn)這個(gè)錯誤怎么回事?
cvc-id.3: A field of identity constraint 'web-common-filter-name-uniqueness' matched element 'web-app', but this element does not have a simple type.出現(xiàn)這個(gè)錯誤怎么回事?
2016-12-21
舉報(bào)
2016-12-22
你使用的Struts是什么版本的,如果是2.3版本的,你按照老師的敲應(yīng)該沒有問題。如果是2.5版本的,我給你如下幾個(gè)提醒:
(1)在web.xml中加載struts2過濾器時(shí),應(yīng)該是:
??????<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
(2)Tomcat無法正常啟動,拋出異常:java.lang.NoClassDefFoundError: Lorg/apache/logging/log4j/Logger;
是因?yàn)槿鄙賚og4j-api-2.7.jar包,將包導(dǎo)入項(xiàng)目中就可以了。
(3)在struts.xml中使用通配符時(shí),編譯沒有問題,但瀏覽器訪問拋出異常:Struts has detected an unhandled exception:
Message:There is no Action mapped for namespace [/] and action name [user_login] associated with context path [/shop].
為了提高安全性,內(nèi)部會驗(yàn)證是否允許訪問該方法,所以要在struts.xml文件中的Action標(biāo)簽里面加上:
<allowed-methods>方法名1,方法名2…</allowed-methods>
2016-12-22
你把filter配置完試試?