Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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
Spring 春天<;mvc:注释驱动/>;及<;mvc:资源可以';你不能一起用吗?_Spring_Model View Controller_Freemarker - Fatal编程技术网

Spring 春天<;mvc:注释驱动/>;及<;mvc:资源可以';你不能一起用吗?

Spring 春天<;mvc:注释驱动/>;及<;mvc:资源可以';你不能一起用吗?,spring,model-view-controller,freemarker,Spring,Model View Controller,Freemarker,我的应用程序的文件夹结构如下所示 web/WEB-INF/templates/ -home.ftl web/resources/css/Home_files -test.css 当同时使用和标记时,它无法解析视图(http://localhost:8080/info/home/index.html) 如果没有,标记视图已解析,但图像和css无法解析 如果没有,,则无法解析标记视图,但可以解析图像和css 如何同时加载视图和静态内容 这是我的配置xml文件和homeCont

我的应用程序的文件夹结构如下所示

web/WEB-INF/templates/
    -home.ftl

web/resources/css/Home_files
    -test.css
当同时使用
标记时,它无法解析视图(http://localhost:8080/info/home/index.html)

  • 如果没有
    标记视图已解析,但图像和css无法解析
  • 如果没有
    ,则无法解析标记视图,但可以解析图像和css
如何同时加载视图和静态内容

这是我的配置xml文件和homeController

info-servlet.xml(配置文件) web.xml

上下文配置位置
/WEB-INF/spring/info-servlet.xml
org.springframework.web.context.ContextLoaderListener
信息
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/spring/info-servlet.xml
1.
信息
/

标签中的路径似乎不正确。在位置末尾添加正斜杠(/)

而不是

<mvc:resources mapping="/resources/**" location="/resources/css/Home_files" />

使用以下命令:

<mvc:resources mapping="/resources/**" location="/resources/css/Home_files/" />


标签中的路径似乎不正确。在位置末尾添加正斜杠(/)

而不是

<mvc:resources mapping="/resources/**" location="/resources/css/Home_files" />

使用以下命令:

<mvc:resources mapping="/resources/**" location="/resources/css/Home_files/" />

<mvc:resources mapping="/resources/**" location="/resources/css/Home_files/" />