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:
javax.servlet.jsp.tagext.BodyTag, java.io.Serializable, 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_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
SendErrorTag()
           
 
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
 

Constructor Detail

SendErrorTag

public SendErrorTag()
Method Detail

doStartTag

public final int doStartTag()
                     throws javax.servlet.jsp.JspException
Method called at start of tag, just returns EVAL_BODY_TAG
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_BODY_TAG

doAfterBody

public final int doAfterBody()
                      throws javax.servlet.jsp.JspException
Read the body of the sendError tag to obtain the error message.
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_BODY

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.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_PAGE

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 Apache Software Foundation. All Rights Reserved.