|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
org.apache.pluto.portlet.admin.taglib.MessageTag
public class MessageTag
Tag to print an error, info, alert, status or success message in a portlet as defined by Cascading Syle Sheet classes in Appendix PLT C of the Java Portlet Specification (JSR-168) version 1.0 (pg 116).
This class uses the PortletMessage and PortletMessageType classes to encapsulates message information. It also can handle a Throwable put in the session (see below), using the getMessage() for the message and printing out the stack trace in an HTML comment. All messages are wrapped in a <p> element containing a 'class' attribute with a spec-defined CSS value, which assumes these are defined in a CSS style sheet used by the JSP page. Right now this class can only handle one message per JSP page.
There are three ways a message can be displayed using this tag:
1. Use the tag's message attribute on the JSP page to set the message
as a String or expression that evaluates to a String. Optionally, you
can use the messageType attribute. Valid messageType attributes
are info, error, status, success and alert. The default message
type is status.
2. Put a message in the portlet session encapsulated in a PortletMessage
object with a PlutoAdminConstants.MESSAGE_ATTR session key. This class
takes care of getting the attribute from the session, using its message and
type data and removing the session attribute.
3. Put a Throwable in the portlet session with a PlutoAdminConstants.ERROR_ATTR
key. This class takes care of getting the attribute from the session,
using its data and removing the session attribute. Throwables are always
given a messageType of error.
PortletMessage
,
PortletMessageType
,
PlutoAdminConstants
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
MSG_ALERT_CSS_CLASS
CSS class for Warning messages. |
static java.lang.String |
MSG_ERROR_CSS_CLASS
CSS class for Error messages. |
static java.lang.String |
MSG_INFO_CSS_CLASS
CSS class for Help messages, general additional information, etc. |
static java.lang.String |
MSG_STATUS_CSS_CLASS
CSS class for Status of the current operation. |
static java.lang.String |
MSG_SUCCESS_CSS_CLASS
CSS class for Verification of the successful completion of a task. |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
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 | |
---|---|
MessageTag()
|
Method Summary | |
---|---|
int |
doStartTag()
Does the work of the tag. |
void |
setCssClass(java.lang.String cssClass)
|
void |
setMessage(java.lang.String message)
|
void |
setMessageType(java.lang.String messageType)
|
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MSG_ERROR_CSS_CLASS
public static final java.lang.String MSG_INFO_CSS_CLASS
public static final java.lang.String MSG_STATUS_CSS_CLASS
public static final java.lang.String MSG_ALERT_CSS_CLASS
public static final java.lang.String MSG_SUCCESS_CSS_CLASS
Constructor Detail |
---|
public MessageTag()
Method Detail |
---|
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
public void setMessage(java.lang.String message)
message
- The error messagepublic void setCssClass(java.lang.String cssClass)
cssClass
- The cssClass to set.public void setMessageType(java.lang.String messageType)
messageType
- The messageType to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |