package com.basic.x01.tag;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.tagext.BodyTagSupport;
|
|
import com.basic.x01.base.BaseController;
|
|
/**
|
* 权限检查标签 <f:access action="a,b,c" > </f:access>
|
*
|
* @company 北京贝思科技术有限公司
|
* @author liuyajun, 8384503@qq.com
|
* @date 2016年1月19日
|
* @time 下午4:14:54
|
*/
|
public final class AccessTag extends BodyTagSupport {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 7163405251158083209L;
|
private String action;
|
|
|
public String getAction() {
|
return action;
|
}
|
public void setAction(String actionId) {
|
this.action = actionId;
|
}
|
|
|
public int doEndTag() throws JspException {
|
try {
|
if(this.bodyContent!=null){
|
this.bodyContent.writeOut(this.bodyContent.getEnclosingWriter());
|
}
|
} catch (Exception e) {
|
//
|
}
|
return EVAL_PAGE;
|
}
|
|
public int doStartTag() throws JspException {
|
|
HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
|
|
boolean output= BaseController.checkAccess(req, action);
|
|
if(output){
|
return EVAL_BODY_INCLUDE;
|
}
|
return SKIP_BODY;
|
}
|
|
}
|