Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java href在spring mvc中不工作_Java_Spring_Jsp_Spring Mvc - Fatal编程技术网

Java href在spring mvc中不工作

Java href在spring mvc中不工作,java,spring,jsp,spring-mvc,Java,Spring,Jsp,Spring Mvc,我有以下项目结构: 我的dispaccher-servlet.xml如下所示: <mvc:resources mapping="/resources/**" location="/resources/" cache-period="31556926"/> <mvc:resources mapping="/WEB-INF/**" location="/WEB-INF/" cache-period="31556926"/> <mvc:annotation-driven

我有以下项目结构:

我的dispaccher-servlet.xml如下所示:

<mvc:resources mapping="/resources/**" location="/resources/" cache-period="31556926"/>
<mvc:resources mapping="/WEB-INF/**" location="/WEB-INF/" cache-period="31556926"/>
<mvc:annotation-driven />


<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

但是,我的jsp中的以下href不起作用:

href="<c:url value="/WEB-INF/views/contact.html"/>"
href=“”
我收到一个http 404错误,说找不到请求的资源

我也试过了

<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
href="${contextPath}/contact.html"/>"

href=“${contextPath}/contact.html”/>”
但这也不起作用:

href="<c:url value="/WEB-INF/views/contact.html"/>"
以下工作:

href="<c:url value="/resources/assets/css/contact.html"/>"
href=“”
但是,我需要在resources/assets/css中创建contact.html的副本


为什么映射/WEB-INF/views/contact.html不起作用?

WEB-INF是一种安全目录,它的内容通常是解析的,而不是直接引用的。
href
在生成的html中是什么样子的?