org.apache.struts.taglib.html
Class MessagesTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.struts.taglib.html.MessagesTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, Tag
Direct Known Subclasses:
NestedMessagesTag

public class MessagesTag
extends 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:
$Rev: 471754 $ $Date: 2005-11-08 23:50:53 -0500 (Tue, 08 Nov 2005) $
See Also:
Serialized Form

Field Summary
protected  String bundle
          The servlet context attribute key for our resources.
protected  String footer
          The message resource key for errors footer.
protected  String header
          The message resource key for errors header.
protected  String id
          The name of the scripting variable to be exposed.
protected  Iterator iterator
          Iterator of the elements of this error collection, while we are actually running.
protected  String locale
          The session attribute key for our locale.
protected  String message
          If this is set to 'true', then the Globals.MESSAGE_KEY will be used to retrieve the messages from scope.
protected static org.apache.struts.util.MessageResources messageResources
          The message resources for this package.
protected  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  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_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
 
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.
 String getBundle()
           
 String getFooter()
           
 String getHeader()
           
 String getId()
           
 String getLocale()
           
 String getMessage()
           
 String getName()
           
 String getProperty()
           
 void release()
          Release all allocated resources.
 void setBundle(String bundle)
           
 void setFooter(String footer)
           
 void setHeader(String header)
           
 void setId(String id)
           
 void setLocale(String locale)
           
 void setMessage(String message)
           
 void setName(String name)
           
 void setProperty(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 org.apache.struts.util.MessageResources messageResources
The message resources for this package.


iterator

protected 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 String id
The name of the scripting variable to be exposed.


bundle

protected String bundle
The servlet context attribute key for our resources.


locale

protected String locale
The session attribute key for our locale.


name

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


property

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


header

protected String header
The message resource key for errors header.


footer

protected String footer
The message resource key for errors footer.


message

protected 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 String getId()
Overrides:
getId in class TagSupport

setId

public void setId(String id)
Overrides:
setId in class TagSupport

getBundle

public String getBundle()

setBundle

public void setBundle(String bundle)

getLocale

public String getLocale()

setLocale

public void setLocale(String locale)

getName

public String getName()

setName

public void setName(String name)

getProperty

public String getProperty()

setProperty

public void setProperty(String property)

getHeader

public String getHeader()

setHeader

public void setHeader(String header)

getFooter

public String getFooter()

setFooter

public void setFooter(String footer)

getMessage

public String getMessage()

setMessage

public void setMessage(String message)

doStartTag

public int doStartTag()
               throws JspException
Construct an iterator for the specified collection, and begin looping through the body once per element.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

doAfterBody

public int doAfterBody()
                throws JspException
Make the next collection element available and loop, or finish the iterations if there are no more elements.

Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws JspException
Clean up after processing this enumeration.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

release

public void release()
Release all allocated resources.

Specified by:
release in interface Tag
Overrides:
release in class BodyTagSupport


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.