?? authoritytag.java
字號(hào):
package com.qrsx.exam.web.taglib;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.qrsx.exam.Constants;
/**
* 用戶權(quán)限校驗(yàn)的標(biāo)簽
*
* @jsp.tag name="authority" body-content="empty"
*
* @author galaxy
*
*/
public class AuthorityTag extends TagSupport {
protected final Log log = LogFactory.getLog(getClass());
public int doEndTag() throws JspException {
// 得到用戶請(qǐng)求對(duì)象
HttpServletRequest request = (HttpServletRequest) pageContext
.getRequest();
Boolean checked = (Boolean) request
.getAttribute(Constants.REQUEST_CHECK_FLAG);
// 判斷是否已經(jīng)進(jìn)行了權(quán)限校驗(yàn)
if (checked != null && checked.booleanValue())
return EVAL_PAGE;
// 對(duì)于沒(méi)有通過(guò)權(quán)限校驗(yàn)的訪問(wèn),返回到登錄頁(yè)面
HttpServletResponse response = (HttpServletResponse) pageContext
.getResponse();
try {
response.sendRedirect(request.getContextPath() + "/logon.jsp");
} catch (IOException ex) {
throw new JspException(ex);
}
return SKIP_PAGE;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -