Java開発–TagSupportを使ってweb画面認証制限をする

javaコード:
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class PageAuthTag extends TagSupport {
private String authLogin;
public String getAuthLogin() {
return authLogin;
}

public void setAuthLogin(String authLogin) {
this.authLogin = authLogin;
}
@Override
public int doAfterBody() throws JspException {
return super.doAfterBody();
}

@Override
public int doEndTag() throws JspException {
return super.doEndTag();

}

@Override
public int doStartTag() throws JspException {
HttpSession session = pageContext.getSession();
String strUser = (String) session.getAttribute(Constants.auth);
if((authLogin.indexOf(strUser) !=-1)||authLogin.equals(“*")){
return EVAL_PAGE;

}
return SKIP_BODY;

}
}

Java

Posted by arkgame