如何在JSP页面struts2中包含css文件? [英] How to include css files in JSP page struts2?
问题描述
我是java的新手。现在我正在做Struts2项目。
在此路径中添加样式表
I'm new to java. And now I'm doing Struts2 project. I added stylesheet in this path
/WEB-INF/common/css/style.css
/WEB-INF/common/css/style.css
并在此路径中添加了引导
and added bootstrap in this path
/ WEB-INF / common / css / bootstrap / bootstrap.min.css
/WEB-INF/common/css/bootstrap/bootstrap.min.css
并将它们包含在JSP文件中
and included them in JSP file as
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="/WEB-INF/common/css/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="/WEB-INF/common/css/style.css" rel="stylesheet" type="text/css">
<title>Login</title>
当我运行程序。在Struts2中需要做什么来包含CSS文件?
But css doesn't work when I run the program. What do I need to do in Struts2 to include CSS files?
推荐答案
您需要将您的CSS文件移出WEB-INF目录,因为它不是公共的。
这里是一个很好的解释什么WEB-INF是如何使用的:
在Java Web应用程序中使用的是什么WEB-INF?
You need to move your css files out of the WEB-INF directory since it is not public. Here is a good explanation of what WEB-INF is and how it should be used: What is WEB-INF used for in a Java web application?
这篇关于如何在JSP页面struts2中包含css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!