Version 4.10.0

Class Messages

  extended by SimpleTagSupport
      extended by hirondelle.web4j.ui.tag.TagHelper
          extended by hirondelle.web4j.ui.translate.Messages
All Implemented Interfaces:
JspTag, SimpleTag

public final class Messages
extends TagHelper

Custom tag for rendering a MessageList.

Example use case :

 <c:if test="${not empty web4j_key_for_messages}"> 
  Message(s) :
  <w:messages name="web4j_key_for_messages">
   <span class="message">placeholder</span><br>
  <c:remove var="web4j_key_for_messages" scope="session"/>

The body of this tag is a simple template for emitting each element of the named MessageList. The special placeholder text is the location where each item returned by MessageList.getMessages() is displayed.

Field Summary
static String PLACEHOLDER
          Special text used by this class to conveniently identify where message text is placed.
Constructor Summary
Method Summary
protected  String getEmittedText(String aOriginalBody)
          Emit given template text for each item in the MessageList.
 void setName(String aMessageListName)
          Key for a MessageList (in any scope).
Methods inherited from class hirondelle.web4j.ui.tag.TagHelper
checkForContent, crossCheckAttributes, doTag, getPageContext, getPageName, getRequest, getResponse
Methods inherited from class SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final String PLACEHOLDER
Special text used by this class to conveniently identify where message text is placed.

See Also:
Constant Field Values
Constructor Detail


public Messages()
Method Detail


public void setName(String aMessageListName)
Key for a MessageList (in any scope).

Required attribute. The ActionImpl class creates two such items, identified with ActionImpl.ERRORS and ActionImpl.MESSAGES.


protected String getEmittedText(String aOriginalBody)
Emit given template text for each item in the MessageList.

Emit the text in this tag's body (which acts as a template), by replacing the special PLACEHOLDER text with the content of each message. The configured implementations of both LocaleSource and Translator are used to render each item. (This performs "last-second localization".)

Specified by:
getEmittedText in class TagHelper
aOriginalBody - is the evaluated body of this tag. If there is no body, or if the body is present but empty, then it is null.
the text to display in the resulting web page.

Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.