MessagesTag (Apache Struts API Documentation)
Keywords: org.apache.struts.taglib.html.MessagesTag,MessagesTag class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.taglib.html
Class MessagesTag

    java.lang.Object
      |
      +--javax.servlet.jsp.tagext.TagSupport
            |
            +--javax.servlet.jsp.tagext.BodyTagSupport
                  |
                  +--org.apache.struts.taglib.html.MessagesTag

All Implemented Interfaces:
  javax.servlet.jsp.tagext.BodyTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

Direct Known Subclasses:
  NestedMessagesTag

public class MessagesTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Custom tag that iterates the elements of a message collection. It defaults to retrieving the messages from `Globals.ERROR_KEY`, but if the message attribute is set to true then the messages will be retrieved from `Globals.MESSAGE_KEY`. This is an alternative to the default `ErrorsTag`.

Since:
  Struts 1.1
Version:
  $Revision: 1.1 $ $Date: 2003-08-26 13:57:44 +0100 (Tue, 26 Aug 2003) $
Author:
  David Winterfeldt
See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `bundle` The servlet context attribute key for our resources.
`protected java.lang.String` | `footer` The message resource key for errors footer.
`protected java.lang.String` | `header` The message resource key for errors header.
`protected java.lang.String` | `id` The name of the scripting variable to be exposed.
`protected java.util.Iterator` | `iterator` Iterator of the elements of this error collection, while we are actually running.
`protected java.lang.String` | `locale` The session attribute key for our locale.
`private static org.apache.commons.logging.Log` | `log` Commons Logging instance.
`protected java.lang.String` | `message` If this is set to 'true', then the `Globals.MESSAGE_KEY` will be used to retrieve the messages from scope.
`protected static MessageResources` | `messageResources` The message resources for this package.
`protected java.lang.String` | `name` The request attribute key for our error messages (if any).
`protected boolean` | `processed` Whether or not any error messages have been processed.
`protected java.lang.String` | `property` The name of the property for which error messages should be returned, or `null` to return all errors.

Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`bodyContent`

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`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
`MessagesTag()`

Method Summary
`int` | `doAfterBody()` Make the next collection element available and loop, or finish the iterations if there are no more elements.
`int` | `doEndTag()` Clean up after processing this enumeration.
`int` | `doStartTag()` Construct an iterator for the specified collection, and begin looping through the body once per element.
`java.lang.String` | `getBundle()`
`java.lang.String` | `getFooter()`
`java.lang.String` | `getHeader()`
`java.lang.String` | `getId()`
`java.lang.String` | `getLocale()`
`java.lang.String` | `getMessage()`
`java.lang.String` | `getName()`
`java.lang.String` | `getProperty()`
`void` | `release()` Release all allocated resources.
`void` | `setBundle(java.lang.String bundle)`
`void` | `setFooter(java.lang.String footer)`
`void` | `setHeader(java.lang.String header)`
`void` | `setId(java.lang.String id)`
`void` | `setLocale(java.lang.String locale)`
`void` | `setMessage(java.lang.String message)`
`void` | `setName(java.lang.String name)`
`void` | `setProperty(java.lang.String property)`

Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`doInitBody, getBodyContent, getPreviousOut, setBodyContent`

Methods inherited from class javax.servlet.jsp.tagext.TagSupport
`findAncestorWithClass, getParent, getValue, getValues, removeValue, 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`

Field Detail

### messageResources

    protected static MessageResources messageResources

  The message resources for this package.

### log

    private static org.apache.commons.logging.Log log

  Commons Logging instance.

### iterator

    protected java.util.Iterator iterator

  Iterator of the elements of this error collection, while we are actually running.

### processed

    protected boolean processed

  Whether or not any error messages have been processed.

### id

    protected java.lang.String id

  The name of the scripting variable to be exposed.

### bundle

    protected java.lang.String bundle

  The servlet context attribute key for our resources.

### locale

    protected java.lang.String locale

  The session attribute key for our locale.

### name

    protected java.lang.String name

  The request attribute key for our error messages (if any).

### property

    protected java.lang.String property

  The name of the property for which error messages should be returned, or `null` to return all errors.

### header

    protected java.lang.String header

  The message resource key for errors header.

### footer

    protected java.lang.String footer

  The message resource key for errors footer.

### message

    protected java.lang.String message

  If this is set to 'true', then the `Globals.MESSAGE_KEY` will be used to retrieve the messages from scope.

Constructor Detail

### MessagesTag

    public MessagesTag()

Method Detail

### getId

    public java.lang.String getId()

  Overrides:
    `getId` in class `javax.servlet.jsp.tagext.TagSupport`

### setId

    public void setId(java.lang.String id)

  Overrides:
    `setId` in class `javax.servlet.jsp.tagext.TagSupport`

### getBundle

    public java.lang.String getBundle()

### setBundle

    public void setBundle(java.lang.String bundle)

### getLocale

    public java.lang.String getLocale()

### setLocale

    public void setLocale(java.lang.String locale)

### getName

    public java.lang.String getName()

### setName

    public void setName(java.lang.String name)

### getProperty

    public java.lang.String getProperty()

### setProperty

    public void setProperty(java.lang.String property)

### getHeader

    public java.lang.String getHeader()

### setHeader

    public void setHeader(java.lang.String header)

### getFooter

    public java.lang.String getFooter()

### setFooter

    public void setFooter(java.lang.String footer)

### getMessage

    public java.lang.String getMessage()

### setMessage

    public void setMessage(java.lang.String message)

### doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException

  Construct an iterator for the specified collection, and begin looping through the body once per element.

  Specified by:
    `doStartTag` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `doStartTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### doAfterBody

    public int doAfterBody()
                    throws javax.servlet.jsp.JspException

  Make the next collection element available and loop, or finish the iterations if there are no more elements.

  Specified by:
    `doAfterBody` in interface `javax.servlet.jsp.tagext.BodyTag`
  Overrides:
    `doAfterBody` in class `javax.servlet.jsp.tagext.BodyTagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### doEndTag

    public int doEndTag()
                 throws javax.servlet.jsp.JspException

  Clean up after processing this enumeration.

  Specified by:
    `doEndTag` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `doEndTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### release

    public void release()

  Release all allocated resources.

  Specified by:
    `release` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `release` in class `javax.servlet.jsp.tagext.BodyTagSupport`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 - Apache Software Foundation