org.apache.taglibs.response
Class SendErrorTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.response.SendErrorTag
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag
public class SendErrorTag
- extends javax.servlet.jsp.tagext.BodyTagSupport
JSP Tag sendError, used to send error as the HTTP Response.
The sendError tag can use an optional error message that it
gets from the body of the tag.
The required attribute error must be set to an HTTP error
code such as SC_UNAUTHORIZED.
If the optional attribute reset is set to true the
buffer, headers, and status code will be reset.
JSP Tag Lib Descriptor
<name>sendError</name>
<tagclass>org.apache.taglibs.response.SendErrorTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Return an HTTP error as the HTTP Response.</info>
<attribute>
<name>error</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>reset</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
- Author:
- Glenn Nielsen
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
int |
doAfterBody()
Read the body of the sendError tag to obtain the error message. |
int |
doEndTag()
Method called at end of Tag used to send an error code,
always returns SKIP_PAGE. |
int |
doStartTag()
Method called at start of tag, just returns EVAL_BODY_TAG |
void |
setError(java.lang.String err)
Required attribute that sets the error code to return. |
void |
setReset(boolean reset)
Optional attribute that flags whether the buffer, headers,
and status code should be reset. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
getParent, setPageContext, setParent |
SendErrorTag
public SendErrorTag()
doStartTag
public final int doStartTag()
throws javax.servlet.jsp.JspException
- Method called at start of tag, just returns EVAL_BODY_TAG
- Specified by:
doStartTag
in interface javax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
- Returns:
- EVAL_BODY_TAG
- Throws:
javax.servlet.jsp.JspException
doAfterBody
public final int doAfterBody()
throws javax.servlet.jsp.JspException
- Read the body of the sendError tag to obtain the error message.
- Specified by:
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
- Returns:
- SKIP_BODY
- Throws:
javax.servlet.jsp.JspException
doEndTag
public final int doEndTag()
throws javax.servlet.jsp.JspException
- Method called at end of Tag used to send an error code,
always returns SKIP_PAGE.
- Specified by:
doEndTag
in interface javax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
- Returns:
- SKIP_PAGE
- Throws:
javax.servlet.jsp.JspException
setError
public final void setError(java.lang.String err)
- Required attribute that sets the error code to return.
The error must be a text string for an error code as
defined in java class HttpServletResponse. For example,
SC_UNATHORIZED to return HTTP error code 401.
- Parameters:
String
- error code, i.e. SC_UNATHORIZED
setReset
public final void setReset(boolean reset)
- Optional attribute that flags whether the buffer, headers,
and status code should be reset.
- Parameters:
boolean
- true or false
Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.