bootstrap侧面菜单栏

导入需要引用的css 和 js

<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/infodetail.css">
<link rel="stylesheet" href="/static/css/metisMenu.min.css">
<link rel="stylesheet" href="/static/css/sb-admin-2.css">
<link rel="stylesheet" href="/static/css/font-awesome.min.css">
<script src="/static/js/jquery.min.js">script>
<script src="/static/js/bootstrap.min.js">script>
<script src="/static/js/metisMenu.min.js">script>
<script src="/static/js/sb-admin-2.js">script>

在controller中绑定

//登录
    @RequestMapping("login.xhtml")
    public String login(HttpServletRequest request){
        HttpSession session = request.getSession();
        session.setMaxInactiveInterval(1000 * 60 * 60 * 12);
        String uname=request.getParameter("uname");
        String upwd=request.getParameter("upwd");
        User user=new User();
        user.setUname(uname);
        user.setUpwd(upwd);
        if(userDao.login(user)!=null){
            StringBuffer sb = new StringBuffer();
            List ZtreeMaxs = ztreeDao.getMaxMuenu();
            for (Ztree ztree : ZtreeMaxs) {
                sb.append("
  • "); if(ztree.getMenu_url()==null||"".equals(ztree.getMenu_url())){ sb.append("+ztree.getMenu_css()+"\">"+ztree.getMenu_name()+" "); sb.append(""); sb.append("
  • "
    ); }else{ sb.append("+ztree.getMenu_css()+"\">"+ztree.getMenu_name()+""); sb.append(""); } } session.setAttribute("MUENU", sb.toString()); return "index"; } return "login"; }

    你可能感兴趣的:(Java)