1 26 27 package org.nextime.ion.frontoffice.taglib; 28 29 import javax.servlet.jsp.tagext.TagSupport ; 30 import javax.servlet.jsp.*; 31 import javax.servlet.http.*; 32 33 public class UserInRoleTag extends TagSupport { 34 35 protected String _role = null; 36 37 public String getRole() { 38 return _role; 39 } 40 41 public void setRole(String role) { 42 _role = role; 43 } 44 45 public int doStartTag() throws JspException { 46 if (checkRole()) 47 return (EVAL_BODY_INCLUDE); 48 else 49 return (SKIP_BODY); 50 } 51 52 public int doEndTag() throws JspException { 53 return (EVAL_PAGE); 54 } 55 56 protected boolean checkRole() { 57 return ((HttpServletRequest)pageContext.getRequest()).isUserInRole(_role); 58 } 59 } 60 61 | Popular Tags |