[英]JSP couldnt link css files and js files
我是jsp的新手。 我正在使用来自netbeans的Glassfish服务器。 问题是我可以将我的jsp文件与CSS和javascript链接。 这是我的文件结构的格式
Web Pages
--Web-Inf
--assets
--css
--style.css
--js
--jquery.js
--includes
--header.jsp
--footer.jsp
--sidebar.jsp
--pages
--home.jsp
--index.jsp
这是我的index.jsp中的代码
<%@include file="includes/header.jsp" %>
<%
if (request.getParameter("page") == null) {
%>
<%@include file="pages/home.jsp" %>
<%
} else {
%>
<%
}
%>
<%@include file="includes/sidebar.jsp" %>
</div>
<!--Latest end-->
<%@include file="includes/footer.jsp" %>
这是我在header.jsp中的代码
<link href="${pageContext.request.contextPath}/assets/css/bootstrap.min.css" rel="stylesheet">
您可以使用相对URL来index.jsp
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.