public class ErrorsTool extends ActionMessagesTool
View tool to work with the Struts error messages.
Template example(s):
#if( $errors.exist() )
<div class="errors">
#foreach( $e in $errors.all )
$e <br>
#end
</div>
#end
Toolbox configuration:
<tool>
<key>errors</key>
<scope>request</scope>
<class>org.apache.velocity.tools.struts.ErrorsTool</class>
</tool>
This tool should only be used in the request scope.
Since VelocityTools 1.1, ErrorsTool extends ActionMessagesTool.
actionMsgs, LOGapplication, locale, request, resources| Constructor and Description |
|---|
ErrorsTool() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getMsgs()
Renders the queued error messages as a list.
|
java.lang.String |
getMsgs(java.lang.String property)
Renders the queued error messages of a particual category as a list.
|
java.lang.String |
getMsgs(java.lang.String property,
java.lang.String bundle)
Renders the queued error messages of a particual category as a list.
|
void |
init(java.lang.Object obj)
Initializes this tool.
|
exist, exist, get, get, getAll, getAll, getGlobal, getGlobalName, getSize, getSizegetResourcespublic void init(java.lang.Object obj)
init in class ActionMessagesToolobj - the current ViewContextjava.lang.IllegalArgumentException - if the param is not a ViewContextpublic java.lang.String getMsgs()
Renders the queued error messages as a list. This method expects
the message keys errors.header and errors.footer
in the message resources. The value of the former is rendered before
the list of error messages and the value of the latter is rendered
after the error messages.
public java.lang.String getMsgs(java.lang.String property)
Renders the queued error messages of a particual category as a list.
This method expects the message keys errors.header and
errors.footer in the message resources. The value of the
former is rendered before the list of error messages and the value of
the latter is rendered after the error messages.
property - the category of errors to renderpublic java.lang.String getMsgs(java.lang.String property,
java.lang.String bundle)
Renders the queued error messages of a particual category as a list.
This method expects the message keys errors.header and
errors.footer in the message resources. The value of the
former is rendered before the list of error messages and the value of
the latter is rendered after the error messages.
property - the category of errors to renderbundle - the message resource bundle to useCopyright (c) 2003-2007 Apache Software Foundation