|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object SimpleTagSupport hirondelle.web4j.ui.tag.TagHelper hirondelle.web4j.ui.translate.Messages
public final class Messages
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> </w:messages> <c:remove var="web4j_key_for_messages" scope="session"/> </c:if>
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 | |
---|---|
Messages()
|
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
Constructor Detail |
---|
public Messages()
Method Detail |
---|
public void setName(String aMessageListName)
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)
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".)
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.
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |