简体   繁体   English

如何在JSP中引用静态资源(如CSS,图像,Java脚本)?

[英]How to give reference to static resources like css,images,java script in JSP?

How to give reference to Static resources like CSS, images, Java Script in JSP? 如何在JSP中引用静态资源,例如CSS, images, Java Script My Web- Application structure is like this: 我的Web应用程序结构如下:

Web Pages
|     ↓
|    Pages
|     ↳  index.jsp <--uses style1.css
↳    Resources
      ↳  css
          ↳  style1.css

Inside index.jsp: 内部index.jsp:

 <head>
     <link rel="stylesheet" type="text/css" href="../Resources/css/style1.css" />
 </head>

But this is not working. 但这是行不通的。

Use: 采用:

<head>
     <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Resources/css/style1.css" />
 </head>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java:如何在jboss platfrom上向用户隐藏html,images等静态资源? - java:how to hide static resources like html ,images from user on jboss platfrom? 如何将放置在war中的UI资源(如CSS,Images和Js文件)用作放置在单独war中的源jsp文件? - How to use UI resources like CSS, Images and Js files which are placed inside a war into the source jsp files that are placed in a separate war? JSP页面无法访问/查找CSS,图像等相关资源 - JSP page can't access/find relative resources like CSS, images 如何使用Struts 2提供静态资源(图像,CSS等)? - How to serve static resources (images, css, etc) using Struts 2? 我的 spring 安全代码未使用 static 资源,如 css、js 和图像文件夹 - my spring security code is not using the static resources like css,js and images folder 如何在我的jsp中的静态资源处添加版本 - how to add version at static resources in my jsp 如何为静态资源(例如CSS,Javascript,图像等)设置Jetty服务器中的到期标头 - How to set expires headers in jetty server for static resources such as CSS, Javascript,images etc 哪里可以放置JS,CSS和Images之类的公共资源? - Where to put public resources like JS, CSS and Images? 在Java eclipse项目中添加资源等静态文件 - Add static files like resources in Java eclipse project 如何引用子模块非java资源(模板、js、css等) - How to reference submodule non-java resources (templates, js, css, etc)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM