Class RoleAttributeTag
java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
org.deltava.taglib.content.RoleAttributeTag
- All Implemented Interfaces:
jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag, Serializable
public class RoleAttributeTag
extends jakarta.servlet.jsp.tagext.TagSupport
A JSP Tag to set an attribute based on role membership.
- Since:
- 2.6
- Version:
- 7.0
- Author:
- Luke
- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, pageContextFields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoEndTag()Closes the JSP and releases state.intChecks for the roles listed and adds the attribute to the request if found.voidrelease()Clears state by reseting the role list.voidSets the request attribute name.voidSets the role(s) a user must belong to in order to view the body of this tag.voidSets the request attribute value.Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
Constructor Details
-
RoleAttributeTag
public RoleAttributeTag()
-
-
Method Details
-
setAttr
Sets the request attribute name.- Parameters:
attrName- the attribute name
-
setValue
Sets the request attribute value.- Parameters:
attrValue- the attribute value
-
setRoles
Sets the role(s) a user must belong to in order to view the body of this tag. Use * (asterisk) for all roles, and a role name prefaced by an ! (exclamation mark) for the lack of role memebrship.- Parameters:
roles- a comma-delimited list of authorized role names
-
release
public void release()Clears state by reseting the role list.- Specified by:
releasein interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
releasein classjakarta.servlet.jsp.tagext.TagSupport
-
doStartTag
public int doStartTag()Checks for the roles listed and adds the attribute to the request if found.- Specified by:
doStartTagin interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjakarta.servlet.jsp.tagext.TagSupport- Returns:
- SKIP_BODY always
-
doEndTag
public int doEndTag()Closes the JSP and releases state.- Specified by:
doEndTagin interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjakarta.servlet.jsp.tagext.TagSupport- Returns:
- EVAL_PAGE always
-