折騰了一晚上,在將一個Eclipse項目轉移到IDEA中時,發現<c:if>
標籤始終不起作用,到最後才發現問題出在了web.xml
文件中,IDEA默認創建的web.xml
文件是這樣的:
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
這樣將SpringMVC的環境搭建好後,<c:if>
標籤不起作用,最後發現如下就可以了:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Archetype Created Web Application</display-name>
</web-app>