我正在与移动设备和台式机友好的网站上工作。我有一个从每个页面调用的JSP菜单栏。当我单独打开菜单栏页面时,它可以正常工作,但是当从另一个页面调用它时,桌面菜单和侧边栏则可以正常工作,但是移动视图导航下拉菜单将无法执行或向下滑动。
JSP菜单栏的调用方式如下
<jsp:include page="menubar.jsp" />
<!-- HEADER MOBILE-->
<header class="header-mobile d-block d-lg-none">
<div class="header-mobile__bar">
<div class="container-fluid">
<div class="header-mobile-inner">
<a class="logo" href="main">
<img src="${pageContext.request.contextPath}/resources/PD_bootstrap/images/icon/logo.png" alt="CoolAdmin" />
</a>
<button class="hamburger hamburger--slider" type="button">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
</div>
</div>
</div>
<nav class="navbar-mobile">
<div class="container-fluid">
<ul class="navbar-mobile__list list-unstyled">
<li>
<a href="main">
<i class="fas fa-tachometer-alt"></i>Dashboard</a>
</li>
<li>
<core:if test="${user=='manager'}">
<a href="loadretailer-web">
<i class="fa fa-mobile-phone"></i>Load DSP</a>
</core:if>
<a href="loadretailer-web">
<core:if test="${user=='retailer_admin'}">
<i class="fa fa-mobile-phone"></i>Load Retailer</a>
</core:if>
</li>
<core:if test="${user=='manager' }">
<li>
<a href="managebranches">
<i class="fa fa-male"></i>Manage DSP</a>
</li>
</core:if>
<li>
<core:if test="${user=='manager'}">
<a href="manageretailers">
<i class="fas fa-users"></i>View Retailers</a>
</core:if>
<core:if test="${user=='retailer_admin'}">
<a href="manageretailers">
<i class="fas fa-users"></i>Manage Retailers</a>
</core:if>
</li>
<li>
<a href="saleshistory-customer">
<i class="fa fa-bar-chart-o "></i>Sales History</a>
</li>
<li>
<a href="webwallethistory">
<i class="fas fa-wallet"></i>Wallet History</a>
</li>
<li>
<a href="simtransactionhistory">
<i class="fas fa-history"></i>Sim Transaction History</a>
</li>
<li>
<a href="transactioninquiry">
<i class="fas fa-question-circle"></i>Transaction Inquiry</a>
</li>
<core:if test="${user == 'retailer_admin' }">
<li>
<a href="schedulebatch">
<i class="fas fa-calendar-alt"></i>Schedule Batch</a>
</li>
</core:if>
</ul>
</div>
</nav>
</header>
<!-- END HEADER MOBILE-->
菜单栏控制器
@RequestMapping(value = "/menubar",method = RequestMethod.GET)
public ModelAndView menuview(HttpServletRequest request,HttpSession session) throws NamingException {
ManageBranchesController managebranches = new ManageBranchesController();
ModelAndView mainpage = new ModelAndView("menubar");
ModelAndView loginpage = new ModelAndView("menubar");
loginpage.addObject("loginForm", new LoginModel());
mainpage.addObject("loginForm", new LoginModel());
HttpSession isSession = request.getSession();
if (null == isSession.getAttribute("USER")) {
//loginpage.addObject("login","yes");
return loginpage;
} else
{
List<ManageBranchesModel> data = null;
data = managebranches.getallbranches(isSession.getAttribute("PID").toString());
mainpage.addObject("username",isSession.getAttribute("USER"));
mainpage.addObject("hide","yes");
mainpage.addObject("user",isSession.getAttribute("USERLEVEL"));
mainpage.addObject("usertype",isSession.getAttribute("USERTYPE"));
mainpage.addObject("partners", data);
return mainpage;
}
}
/**
* Renders Main Controller Page.
*
* @params login
* @return main.html
*/
@RequestMapping(value = "/menubar",method = RequestMethod.GET,params={"login"})
public ModelAndView menuview1(@RequestParam("login") String login,HttpServletRequest request) throws NamingException {
ModelAndView mainpage = new ModelAndView("menubar");
ModelAndView loginpage = new ModelAndView("menubar");
loginpage.addObject("loginForm", new LoginModel());
mainpage.addObject("loginForm", new LoginModel());
HttpSession isSession = request.getSession();
mainpage.addObject("username",isSession.getAttribute("USER"));
mainpage.addObject("hide","no");
mainpage.addObject("user",isSession.getAttribute("USERLEVEL"));
mainpage.addObject("usertype",isSession.getAttribute("USERTYPE"));
mainpage.addObject("login","no");
return mainpage;
}