1.定义两个jsp ‘1.jsp' '2.jsp'
1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<!--主导航页-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<%@include file="/static/headjs.jsp"%>
<body>
<!--统一导航栏-->
<div class="center">
<jsp:include file="/2.jsp"/jsp>
>
</div>
2.jsp
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@include file="/static/headjs.jsp"%>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
2.注意事项
1.jsp和2.jsp是分别单独编译的,所以
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@include file="/static/headjs.jsp"%>
这些引用每个页面都需单独拥有,被引用页面最好是固定值,<jsp:include file="/2.jsp"/jsp>会先加载后编译,注意不要重复加载js