Class ReasonTag

All Implemented Interfaces:
JspTag, SimpleTag

public class ReasonTag extends XmlSupport
Outputs the HTTP status Reason Phrase for either the explicitly supplied status code or, when none is provided, the status code associated with the current error being processed by the JSP container.

If no reason phrase is available, the tag prints the configured default value. XML escaping is applied when enabled.

Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • ReasonTag

      public ReasonTag()
  • Method Details

    • doTag

      public void doTag() throws IOException
      Writes the Reason Phrase for the current or specified HTTP status code. If the page is not processing an error and no explicit code is set, the default value is used instead.
      Specified by:
      doTag in interface SimpleTag
      Overrides:
      doTag in class SimpleTagSupport
      Throws:
      IOException - If an error occurs while writing output
    • setCode

      public void setCode(int statusCode)
      Sets the HTTP status code to be used when resolving the Reason Phrase.