共用文件

top.jsp

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../data/conn.jsp"%>
<%
try{
String Smenu="";
int i=0;
int j=0;
int Fid=0;
//查询当前用户的菜单访问权限
ResultSet rs_user=stmt.executeQuery("select * from crm_user where id='"+session.getAttribute("SessionUid")+"'");
if(rs_user.next()){
	Smenu=rs_user.getString("menu_level");
}

ResultSet rs_menu=stmt.executeQuery("select * from crm_navmenu where FIND_IN_SET(id,'"+Smenu+"') and status=1 order by inrow");
rs_menu.last();
int rowcount=rs_menu.getRow();
int arr_id[]=new int[rowcount];
String arr_label[]=new String[rowcount];
String arr_path[]=new String[rowcount];
int arr_father[]=new int[rowcount];
rs_menu.beforeFirst();
i=0;
while(rs_menu.next()){
	arr_id[i]=Integer.parseInt(rs_menu.getString("id"));
	arr_label[i]=rs_menu.getString("menu_label");
	arr_path[i]=rs_menu.getString("menu_path");
	arr_father[i]=Integer.parseInt(rs_menu.getString("menu_father"));
	i++;
}
rs_menu.close();

%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/plugin/bootstrap/bootstrap.css">
<script src="/plugin/niuguwen/js/jquery.min.js"></script>
<script src="/plugin/bootstrap/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="/plugin/niuguwen/iconfont/iconfont.css">
<link rel="stylesheet" type="text/css" href="/plugin/niuguwen/css/niuguwen.css">
<link rel="stylesheet" type="text/css" href="/skins/default/style.css">
</head>

<body>

<nav class="navbar navbar-default" role="navigation">
	<div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="/admin/index.jsp">Tinwin</a>
        </div>
        <div>
            <ul class="nav navbar-nav">
                <%
				for(i=0;i<rowcount;i++){
					if(arr_father[i]==0){
						String Smain=arr_label[i];
						Fid=arr_id[i];%>
				
                		<li class="dropdown">
                    		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=Smain%>
                        	<b class="caret"></b>
                    		</a>
                            <ul class="dropdown-menu">
                                <%
                                    for(j=0;j<rowcount;j++){
                                        if(Fid==arr_father[j]){
                                            if(arr_path[j].equals("divider")||arr_label[j].equals("-")){%>
                                                <li class="divider"></li>
                                            <%}else{%>
                                                <li><a href="<%=arr_path[j]%>"><%=arr_label[j]%></a></li>
                                            <%}
                                        }
                                    }%>
                            </ul>
                		</li>
                    <%}%>
                <%}%>
            </ul>
        </div>
        <div class="pull-right" style="height:50px; line-height:50px; font-size:16px;"><span class="iconfont icon-geren"></span> <%=session.getAttribute("SessionName")%><a href="loginout.jsp">注销</a></div>
	</div>
</nav>
<%
}catch(SQLException ex){
  System.err.println("执行错误:"+ex.getMessage() ); 
}
%>

bottom.jsp

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<footer class="right"></footer>
</body>
</html>

check.jsp

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
if(session.getAttribute("login")==null||!session.getAttribute("login").equals("ok")){
	session.setAttribute("SessionName","");
	session.removeAttribute("SessionName");
	session.setAttribute("SessionUid","");
	session.removeAttribute("SessionUid");
	session.setAttribute("login","");
	session.removeAttribute("login");
	//session.invalidate();
	response.sendRedirect(basePath+"login.jsp");
}
%>


文章导航