|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.struts.MessageResourcesTool
org.apache.velocity.tools.struts.ActionMessagesTool
org.apache.velocity.tools.struts.ErrorsTool
public class ErrorsTool
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.
Field Summary |
---|
Fields inherited from class org.apache.velocity.tools.struts.ActionMessagesTool |
---|
actionMsgs, LOG |
Fields inherited from class org.apache.velocity.tools.struts.MessageResourcesTool |
---|
application, locale, request, resources |
Constructor Summary | |
---|---|
ErrorsTool()
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.velocity.tools.struts.ActionMessagesTool |
---|
exist, exist, get, get, getAll, getAll, getGlobal, getGlobalName, getSize, getSize |
Methods inherited from class org.apache.velocity.tools.struts.MessageResourcesTool |
---|
getResources |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ErrorsTool()
Method Detail |
---|
public void init(java.lang.Object obj)
init
in class ActionMessagesTool
obj
- the current ViewContext
java.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 render
public 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 use
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |