I have a problem that when I use <jsp:forward>
tag in my index.jsp
to forward to other pages such as main.jsp
, I can't find my static resource anymore.But when i browse main.jsp
directly,there are no problems.
this is the head tag of my main.jsp
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0, user-scalable=0"/>
<meta content="yes" name="apple-mobile-web-app-capable"/>
<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="email=no" name="format-detection"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css" href="../styles/swiper.min.css">
<link rel="stylesheet" type="text/css" href="../styles/index.css"/>
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script type="text/javascript" src="../scripts/picBox.js"></script>
<script type="text/javascript" src="../scripts/swiper.jquery.js"></script>
<script type="text/javascript" src="../scripts/pagination.js"></script>
</head>
<body>
this is my index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<jsp:forward page='/WEB-INF/pages/main/main.jsp'/>
</body>
</html>