JSF项目中实现基于RBAC模型的权限管理设计(二) 转
<lifecycle>?????
package com.laomao.view.listener;
importimportimportimportimportimportimportimportimportimport?
public???
??????
??????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????
??????????????????????????????????????????????
????????????????????????????????????????????
????????????????????????}
?
?
????????
<application>??</application>
?
步骤二:实现我们自己的ActionListener接口
package com.laomao.view.listener;
import javax.el.ELContext;
import javax.el.MethodExpression;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.NavigationHandler;
import javax.faces.component.ActionSource2;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
?
public class ActionListenerImpl implements ActionListener {
??????
???????????????
??????????????????????????????
???????????????
????????????}
????????}
?
????????NavigationHandler navigationHandler = application.getNavigationHandler();
????????navigationHandler.handleNavigation(facesContext,fromAction,outcome);
????????//Render Response if needed
????????facesContext.renderResponse();
?
???????}
??????
???????/**
????????*?转入无权限声明页面
????????* @param expression
????????*/
???????private void gotoNoPermissionPage(MethodExpression expression) {
????????FacesContext context = FacesContext.getCurrentInstance();
????????Application application = context.getApplication();
???????????????
????????NavigationHandler navHandler = application.getNavigationHandler();
????????navHandler.handleNavigation(context, null == expression ? null : expression.getExpressionString(), Constants.NAVIGATION_NO_PERMISSION);
????????context.renderResponse();
????}
?
}
?
转:http://laomaowww.blog.163.com/blog/static/16600567320124751827427/