权限控制
粗粒度权限控制
没有经过登录页面是没办法访问主界面的
细粒度权限控制
不同的用户登录后看到的左侧菜单不同
当点击用户管理是,功能是用户查询,检查当前用户是否有用户查询的权限,如果有,则查询,如果没有,则提示权限不足。
在登录的时候,把user放入到session中。
在加载树的时候,可以把user从session中取出来。
从user中获取uid。
1
| from Privilege p inner join fetch p.roles r inner join fetch r.users u where u.uid = uid and flag ='1'
|
代码
basedao
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| package cn.itcast.shoa.dao.base;
import java.io.Serializable; import java.util.Collection; import java.util.Set;
public interface BaseDao<E>{
public Collection<E> getAllEntry();
public E getEntryById(Serializable id); public void saveEntry(E e); public void deleteEntry(Serializable id); public void updateEntry(E e);
public Set<E> getEntrysByIDS(Serializable[] ids); public Set<E> getEntrysByIDS(String ids); public E getEntryByCondition(final String entityName,final String... objects); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
| package cn.itcast.shoa.dao.base.impl;
import java.io.Serializable; import java.lang.reflect.ParameterizedType; import java.sql.SQLException; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set;
import javax.annotation.PostConstruct; import javax.annotation.Resource;
import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.metadata.ClassMetadata; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.HibernateTemplate;
import cn.itcast.shoa.dao.base.BaseDao;
public class BaseDaoImpl<E> implements BaseDao<E>{ private Class classt;
private ClassMetadata classMetadata; public BaseDaoImpl(){
ParameterizedType type = (ParameterizedType)this.getClass().getGenericSuperclass(); this.classt = (Class)type.getActualTypeArguments()[0]; }
@PostConstruct public void init(){ this.classMetadata = this.hibernateTemplate.getSessionFactory().getClassMetadata(this.classt); } @Resource(name="hibernateTemplate") public HibernateTemplate hibernateTemplate;
@Override public Collection<E> getAllEntry() { return this.hibernateTemplate.find("from "+this.classt.getName()); } @Override public E getEntryById(Serializable id) {
return (E)this.hibernateTemplate. find("from "+this.classt.getName() + " where " +classMetadata.getIdentifierPropertyName() +"=?", id).get(0); } @Override public void saveEntry(E e) { this.hibernateTemplate.save(e); } @Override public void deleteEntry(Serializable id) { E e = this.getEntryById(id); this.hibernateTemplate.delete(e); } @Override public void updateEntry(E e) { this.hibernateTemplate.update(e); } @Override public Set<E> getEntrysByIDS(Serializable[] ids) {
StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("from "+this.classt.getName()); stringBuffer.append(" where "+this.classMetadata.getIdentifierPropertyName()); stringBuffer.append(" in ("); for(int i=0;i<ids.length;i++){ if(i==ids.length-1){ stringBuffer.append(ids[i]); }else{ stringBuffer.append(ids[i]+","); } } stringBuffer.append(")"); List<E> list = this.hibernateTemplate.find(stringBuffer.toString()); return new HashSet<E>(list); }
@Override public Set<E> getEntrysByIDS(String ids) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("from "+this.classt.getName()); stringBuffer.append(" where "+this.classMetadata.getIdentifierPropertyName()); stringBuffer.append(" in("); stringBuffer.append(ids); stringBuffer.append(")"); List<E> list = this.hibernateTemplate.find(stringBuffer.toString()); return new HashSet<E>(list); }
@Override public E getEntryByCondition(final String hql,final String... objects) { return this.hibernateTemplate.execute(new HibernateCallback<E>() { @Override public E doInHibernate(Session session) throws HibernateException, SQLException { Query query = session.createQuery(hql); int index = 0; for(String s:objects){ query.setParameter(index, s); index++; } return (E)query.uniqueResult(); } }); } }
|
LoginDao
1 2 3 4 5 6 7 8
| package cn.itcast.shoa.dao;
import cn.itcast.shoa.dao.base.BaseDao; import cn.itcast.shoa.domain.system.User;
public interface LoginDao extends BaseDao<User>{
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| package cn.itcast.shoa.dao.impl;
import javax.annotation.Resource;
import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.stereotype.Repository;
import cn.itcast.shoa.dao.LoginDao; import cn.itcast.shoa.dao.base.impl.BaseDaoImpl; import cn.itcast.shoa.domain.system.User;
@Repository("loginDao") public class LoginDaoImpl extends BaseDaoImpl<User> implements LoginDao{ }
|
1 2 3 4 5 6 7 8 9 10
| package cn.itcast.shoa.dao;
import java.util.Collection;
import cn.itcast.shoa.dao.base.BaseDao; import cn.itcast.shoa.domain.menuitem.Menuitem;
public interface MenuitemDao extends BaseDao<Menuitem>{ }
|
1 2 3 4 5 6 7 8 9 10 11 12
| package cn.itcast.shoa.dao.impl;
import org.springframework.stereotype.Repository;
import cn.itcast.shoa.dao.MenuitemDao; import cn.itcast.shoa.dao.base.impl.BaseDaoImpl; import cn.itcast.shoa.domain.menuitem.Menuitem;
@Repository("menuitemDao") public class MenuitemDaoImpl extends BaseDaoImpl<Menuitem> implements MenuitemDao{
}
|
domain下新建menuitem包,创建menuitem实体类和配置文件,修改privilege相关文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| package cn.itcast.shoa.domain.menuitem;
import java.io.Serializable;
public class Menuitem implements Serializable{ private Long mid; private Long pid; private String name; private Boolean isParent; private String icon; public Long getMid() { return mid; } public void setMid(Long mid) { this.mid = mid; } public Long getPid() { return pid; } public void setPid(Long pid) { this.pid = pid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Boolean getIsParent() { return isParent; } public void setIsParent(Boolean isParent) { this.isParent = isParent; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="cn.itcast.shoa.domain.menuitem.Menuitem"> <id name="mid" length="5"> <generator class="assigned"></generator> </id> <property name="pid" length="5"></property> <property name="name" length="20"></property> <property name="icon" length="100"></property> <property name="isParent"></property> </class> </hibernate-mapping>
|
privilegeService
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| package cn.itcast.shoa.service;
import java.util.Collection; import java.util.Set;
import cn.itcast.shoa.domain.system.Privilege;
public interface PrivilegeService { public Collection<Privilege> getPrivilegesByRid(Long rid); public void savePrivilege(Long rid,String checkedStr); public Collection<Privilege> getPrivilegesByUid(Long uid,String username); }
|
PrivilegeServiceImpl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| package cn.itcast.shoa.service.impl;
import java.util.Collection; import java.util.Set;
import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
import cn.itcast.shoa.dao.PrivilegeDao; import cn.itcast.shoa.dao.RoleDao; import cn.itcast.shoa.domain.system.Privilege; import cn.itcast.shoa.domain.system.Role; import cn.itcast.shoa.service.PrivilegeService;
@Service("privilegeService") public class PrivilegeServiceImpl implements PrivilegeService{ @Resource(name="privilegeDao") private PrivilegeDao privilegeDao; @Resource(name="roleDao") private RoleDao roleDao;
@Override public Collection<Privilege> getPrivilegesByRid(Long rid) { return this.privilegeDao.getPrivilegesByRid(rid); }
@Transactional(readOnly=false) public void savePrivilege(Long rid, String checkedStr) { Role role = this.roleDao.getEntryById(rid); Set<Privilege> privileges = this.privilegeDao.getEntrysByIDS(checkedStr); role.setPrivileges(privileges); this.roleDao.updateEntry(role); }
@Override public Collection<Privilege> getPrivilegesByUid(Long uid,String username) { return this.privilegeDao.getMenuitemsByUid(uid,username); } }
|
1 2 3 4 5 6 7 8 9 10
| package cn.itcast.shoa.service;
import java.util.Collection;
import cn.itcast.shoa.domain.menuitem.Menuitem;
public interface MenuitemService { public Collection<Menuitem> getAllMenuitem(); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| package cn.itcast.shoa.service.impl;
import java.util.Collection;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.itcast.shoa.dao.MenuitemDao; import cn.itcast.shoa.domain.menuitem.Menuitem; import cn.itcast.shoa.service.MenuitemService;
@Service("menuitemService") public class MenuitemServiceImpl implements MenuitemService{ @Resource(name="menuitemDao") private MenuitemDao menuitemDao;
@Override public Collection<Menuitem> getAllMenuitem() { return this.menuitemDao.getAllEntry(); } }
|
FowardAction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| package cn.itcast.shoa.struts.action;
import com.opensymphony.xwork2.ActionSupport;
public class FowardAction extends ActionSupport{ private String method; public String getMethod() { return method; }
public void setMethod(String method) { this.method = method; }
public String forward(){ return this.method; } }
|
LoginAction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| package cn.itcast.shoa.struts.action;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller;
import cn.itcast.shoa.domain.system.User; import cn.itcast.shoa.service.LoginService; import cn.itcast.shoa.struts.action.base.BaseAction; import cn.itcast.shoa.utils.OAUtils;
@Controller("loginAction") @Scope("prototype") public class LoginAction extends BaseAction<User>{ @Resource(name="loginService") private LoginService loginService; public String login(){ User user = this.loginService.login(this.getModel().getUsername(), this.getModel().getPassword()); if(user==null){ this.addActionMessage("用户名或者密码错误"); return "input"; }else{ OAUtils.putUserToSession(user); return "index"; } } }
|
privilegeAction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| package cn.itcast.shoa.struts.action;
import java.util.Collection; import java.util.Set;
import javax.annotation.Resource;
import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionContext;
import cn.itcast.shoa.domain.system.Privilege; import cn.itcast.shoa.domain.system.Role; import cn.itcast.shoa.domain.system.User; import cn.itcast.shoa.service.PrivilegeService; import cn.itcast.shoa.service.RoleService; import cn.itcast.shoa.service.UserService; import cn.itcast.shoa.struts.action.base.BaseAction; import cn.itcast.shoa.util.OAUtils;
@Controller("privilegeAction") @Scope("prototype") public class PrivilegeAction extends BaseAction<Privilege>{ private Long rid; private String checkedStr;
public String getCheckedStr() { return checkedStr; }
public void setCheckedStr(String checkedStr) { this.checkedStr = checkedStr; }
public Long getRid() { return rid; }
public void setRid(Long rid) { this.rid = rid; }
@Resource(name="privilegeService") private PrivilegeService privilegeService; @Resource(name="roleService") private RoleService roleService; public String showPrivilegeByRid(){ Collection<Privilege> privileges = this.privilegeService.getPrivilegesByRid(rid); ActionContext.getContext().getValueStack().push(privileges); return SUCCESS; } public String showMenuitemTreeByUid(){ User user = OAUtils.getUserFromSession(); Collection<Privilege> privileges = this.privilegeService.getPrivilegesByUid(user.getUid(),user.getUsername()); ActionContext.getContext().getValueStack().push(privileges); return SUCCESS; } public String savePrivilege(){ this.privilegeService.savePrivilege(rid, checkedStr); return SUCCESS; } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| package cn.itcast.shoa.struts.action;
import java.util.Collection;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionContext;
import cn.itcast.shoa.domain.menuitem.Menuitem; import cn.itcast.shoa.service.MenuitemService; import cn.itcast.shoa.struts.action.base.BaseAction;
@Controller("menuitemAction") @Scope("prototype") public class MenuitemAction extends BaseAction<Menuitem>{ @Resource(name="menuitemService") private MenuitemService menuitemService; public String showAllMenuitem(){ Collection<Menuitem> menuitems = this.menuitemService.getAllMenuitem(); ActionContext.getContext().getValueStack().push(menuitems); return SUCCESS; } }
|
OAUtils
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| package cn.itcast.shoa.utils;
import org.apache.struts2.ServletActionContext;
import cn.itcast.shoa.domain.system.User;
public class OAUtils { public static void putUserToSession(User user){ ServletActionContext.getRequest() .getSession().setAttribute("user", user); } public static User getUserFromSession(){ return (User)ServletActionContext.getRequest() .getSession().getAttribute("user"); } }
|
struts-login.xml
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts> <package name="login" namespace="/" extends="struts-default"> <action name="loginAction_*" method="{1}" class="loginAction"> <result name="input">login.jsp</result> <result name="index">WEB-INF/jsp/frame/index.jsp</result> </action> </package> </struts>
|
struts-forward.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts> <package name="forward" namespace="/" extends="struts-default"> <action name="forwardAction_*" method="{1}" class="cn.itcast.shoa.struts.action.ForwardAction"> <result name="top">WEB-INF/jsp/frame/top.jsp</result> <result name="bottom">WEB-INF/jsp/frame/bottom.jsp</result> <result name="left">WEB-INF/jsp/frame/left.jsp</result> <result name="right">WEB-INF/jsp/frame/right.jsp</result> </action> </package> </struts>
|
1 2 3 4 5 6 7 8 9 10 11 12
| <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts> <package name="menuitem" namespace="/" extends="json-default"> <action name="menuitemAction_*" method="{1}" class="menuitemAction"> <result type="json"></result> </action> </package> </struts>
|
struts.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts> <constant name="struts.devMode" value="true"/> <constant name="struts.ui.theme" value="simple"/> <include file="struts/struts-person.xml"></include> <include file="struts/struts-department.xml"></include> <include file="struts/struts-role.xml"></include> <include file="struts/struts-user.xml"></include> <include file="struts/struts-login.xml"></include> <include file="struts/struts-forward.xml"></include> <include file="struts/struts-menuitem.xml"></include> <include file="struts/struts-privilege.xml"></include> <package name="struts-global" namespace="/" extends="struts-default"> <global-results> <result name="errHandler" type="chain"> <param name="actionName">errorProcessor</param> </result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="errHandler" /> </global-exception-mappings>
<action name="errorProcessor" class="cn.itcast.shoa.exception.MyException"> <result name="error">WEB-INF/jsp/error.jsp</result> </action> </package> </struts>
|
jsp包下新建frame包,包括botton、index、top、left、right等jsp文件
bottom
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <html> <head> <title>Bottom</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/blue/statusbar.css" /> </head> <body style="margin:0">
<div id="StatusBar"> <div id="Online"> 在线人员:共 <span class="OnlineUser" id="onlineUserNum"></span> 人 <span class="OnlineView"><a href="javascript:void(0)">[查看在线名单]</a></span> </div> <div id="Info"> <a href="http://www.itcast.cn" title = "传智播客首页" target="_blank">传智播客首页</a> | <a href="http://bbs.itcast.cn" title = "传智播客BBS" target="_blank">传智播客BBS</a> </div> <div id="DesktopText"> <a href="javascript:void(0)"><img border="0" src="${pageContext.request.contextPath}/css/images/top/text.gif"/>便笺</a> <span id=TryoutInfo></span> <span id="Version"> <a href="javascript:void(0)"> <img border="0" width="11" height="11" src="${pageContext.request.contextPath}/css/images/top/help.gif" /> <img border="0" width="40" height="11" src="${pageContext.request.contextPath}/css/blue/images/top/version.gif" /> </a> </span> </div> </div>
</body> </html>
|
index
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <html> <head> <title>ItcastOA</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <frameset rows="100,*,25" framespacing="0" border="0" frameborder="0"> <frame src="forwardAction_forward.action?method=top" name="TopMenu" scrolling="no" noresize /> <frameset cols="180,*" id="resize"> <frame noresize name="menu" src="forwardAction_forward.action?method=left" scrolling="yes" /> <frame noresize name="right" src="forwardAction_forward.action?method=right" scrolling="yes" /> </frameset> <frame noresize name="status_bar" scrolling="no" src="forwardAction_forward.action?method=bottom" /> </frameset> <noframes> <body> </body> </noframes> </html>
|
left
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <script language="javascript" src="${pageContext.request.contextPath}/js/jquery-plugin-namespace.js"></script> <script language="javascript" src="${pageContext.request.contextPath}/js/jQuery-plugin-tree.js"></script> <script language="javascript" src="${pageContext.request.contextPath}/js/menuitem.js"></script> <html> <head> <title>导航菜单</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="zTreeStyle/zTreeStyle.css" type="text/css"> </head> <body style="margin: 0"> <TABLE border=0 width="700"> <TR> <TD width=340px align=center valign=top> <div class="zTreeDemoBackground"> <ul id="menuTree" class="tree"></ul> </div> </TD> </TR> </TABLE> </body> </html>
|
right
1 2 3 4 5 6 7 8 9 10 11
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <html> <head> <title>Right</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body>
</body> </html>
|
top
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <html> <head> <title>Top</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/blue/top.css" /> </head>
<body class="PageBody" style="margin: 0"> <div id="Head1"> <div id="Logo"> <a id="msgLink" href="javascript:void(0)"></a> <font color="#0000CC" style="color:#F1F9FE; font-size:28px; font-family:Arial Black, Arial">Itcast OA</font> <!--<img border="0" src="${pageContext.request.contextPath}/css/blue/images/logo.png" />--> </div> <div id="Head1Right"> <div id="Head1Right_UserName"> <img border="0" width="13" height="14" src="${pageContext.request.contextPath}/css/images/top/user.gif" /> 您好,<b>管理员</b> </div> <div id="Head1Right_UserDept"></div> <div id="Head1Right_UserSetup"> <a href="javascript:void(0)"> <img border="0" width="13" height="14" src="${pageContext.request.contextPath}/css/images/top/user_setup.gif" /> 个人设置 </a> </div> <div id="Head1Right_Time"></div> </div> <div id="Head1Right_SystemButton"> <a target="_parent" href="System_User/logout.html"> <img width="78" height="20" alt="退出系统" src="${pageContext.request.contextPath}/css/blue/images/top/logout.gif" /> </a> </div> <div id="Head1Right_Button"> <a target="desktop" href="/desktop?method=show"> <img width="65" height="20" alt="显示桌面" src="${pageContext.request.contextPath}/css/blue/images/top/desktop.gif" /> </a> </div> </div> <div id="Head2"> <div id="Head2_Awoke"> <ul id="AwokeNum"> <li><a target="desktop" href="javascript:void(0)"> <img border="0" width="11" height="13" src="${pageContext.request.contextPath}/css/images/top/msg.gif" /> 消息 <span id="msg"></span> </a> </li> <li class="Line"></li> <li><a target="desktop" href="javascript:void(0)"> <img border="0" width="16" height="11" src="${pageContext.request.contextPath}/css/images/top/mail.gif" /> 邮件 <span id="mail"></span> </a> </li> <li class="Line"></li> <!-- 是否有待审批文档的提示1,数量 --> <li><a href="Flow_Formflow/myTaskList.html" target="desktop"> <img border="0" width="12" height="14" src="${pageContext.request.contextPath}/css/images/top/wait.gif" /> 待办事项(<span id="wait" class="taskListSize">1</span>) </a> </li> <!-- 是否有待审批文档的提示2,提示审批 --> <li id="messageArea">您有 1 个待审批文档,请及时审批!★★★★★</li> </ul> </div> <div id="Head2_FunctionList"> <marquee style="WIDTH: 100%;" onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount=1 scrolldelay=30 direction=left> <b>这是滚动的消息</b> </marquee> </div> </div>
</body> </html>
|
1 2 3 4 5 6 7 8 9 10 11 12
| $().ready(function(){ $.nameSpace("cn.itcast.sh05.oa.MenuItemTree"); $.extend(cn.itcast.sh05.oa.MenuItemTree,$.fn.TreePanel); cn.itcast.sh05.oa.MenuItemTree.createTree({ url:'privilegeAction_showMenuitemTreeByUid.action', data:null, id:'menuTree' }); });
|
login.jsp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/common/common.jsp"%> <HTML> <HEAD> <META http-equiv=Content-Type CONTENT="text/html; charset=gbk" /> <TITLE>Itcast OA</TITLE> <LINK HREF="${pageContext.request.contextPath}/css/blue/login.css" type=text/css rel=stylesheet /> </HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 CLASS=PageBody > <s:form action="loginAction_login.action"> <DIV ID="CenterAreaBg"> <DIV ID="CenterArea"> <DIV ID="LogoImg"><IMG BORDER="0" SRC="${pageContext.request.contextPath}/css/blue/images/logo.png" /></DIV> <DIV ID="LoginInfo"> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 width=100%> <TR> <TD width=45 CLASS="Subject"><IMG BORDER="0" SRC="${pageContext.request.contextPath}/css/blue/images/login/userId.gif" /></TD> <s:actionmessage/> <s:property value="#login"/> <TD><s:textfield name="username" cssClass="TextField"></s:textfield></TD> <TD ROWSPAN="2" STYLE="padding-left:10px;"><INPUT TYPE="image" SRC="${pageContext.request.contextPath}/css/blue/images/login/userLogin_button.gif"/></TD> </TR> <TR> <TD CLASS="Subject"><IMG BORDER="0" SRC="${pageContext.request.contextPath}/css/blue/images/login/password.gif" /></TD> <TD><s:password name="password" cssClass="TextField"></s:password></TD> </TR> </TABLE> </DIV> <DIV ID="CopyRight"><A HREF="javascript:void(0)">© 2010 版权所有 itcast</A></DIV> </DIV> </DIV> </s:form> </BODY>
</HTML>
|
数据库privilege表中,用户管理与部门管理添加url和target。
1 2 3
| 统一:right 用户管理:userAction_showAllUser.action 部门管理:roleAction_showAllRole.action
|