Spring不能加载我的css文件

编程入门 行业动态 更新时间:2024-10-28 06:22:16
本文介绍了Spring不能加载我的css文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Spring无法加载我的CSS文件,这是我的架构:

  • 项目
    • Webcontent
    • WEB-INF
      • pages
        • jsp
      • css
        • jquery-ui.css
      • h2_lin>解决方案

        您可以将css文件和其他文件(如javascript,图像)放在文件夹资源中 项目

        Webcontent 资源 css jquery-ui.css WEB-INF pages 索引。 jsp

        将以下行放入spring配置

        < mvc:resources mapping =/ resources / **location =/ resources //>

        并在jsp页面中提供

        < link href =$ {pageContext.request.contextPath} /resources/css/jquery-ui.css rel =stylesheet>

        Spring can't load my css files and this is my architecture:

        • Project
          • Webcontent
          • WEB-INF
            • pages
              • index.jsp
            • css
              • jquery-ui.css

        解决方案

        You can put the css file and other files like javascript, images in the folder resources Project

        Webcontent resources css jquery-ui.css WEB-INF pages index.jsp

        And put the following line in spring configuration

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

        And give the reference in jsp pages like

        <link href="${pageContext.request.contextPath}/resources/css/jquery-ui.css" rel="stylesheet">

更多推荐

Spring不能加载我的css文件

本文发布于:2023-11-02 03:22:23,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   文件   Spring   css

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!