|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--gnu.beanfactory.servlet.FormHandler
FormHandler is an abstract base class that provides a standard mechanism for processing HTML form input. This class provides facilities for form field validation and handling exceptions. Classes that extend FormHandler should be declared as either "session" or "request" scoped. A typical implementation would:
| Field Summary | |
java.lang.String |
myMessage
|
| Constructor Summary | |
FormHandler()
|
|
| Method Summary | |
void |
forward(java.lang.String s)
Convenience method to forward the request to a local resource. |
void |
forwardToFormErrorURL()
Convenience method to forward the request to the proper page. |
void |
forwardToNextURL()
Convenience method to forward the request to the proper page. |
void |
forwardToPrevURL()
Convenience method to forward the request to the proper page. |
java.lang.String |
getError(java.lang.String prop)
|
java.lang.String |
getErrorMessage()
|
java.lang.String |
getFormErrorURL()
URL that the FormHandler should redirect to if there is a form error. |
java.lang.String |
getMessage()
A simple property to store a message. |
java.lang.String |
getNextURL()
|
org.apache.oro.text.perl.Perl5Util |
getPerl5Util()
Convenience method to get an instance of the ORO Perl Regex engine. |
java.lang.String |
getPrevURL()
|
javax.servlet.http.HttpServletRequest |
getRequest()
A convenience method to obtain the current ServletRequest. |
javax.servlet.http.HttpServletResponse |
getResponse()
A convenience method to obtain the current ServletResponse. |
boolean |
isValid()
Checks to see if this instance has any form errors. |
void |
postSet()
This method gets invoked after the setXXX() methods are called but before the handleXXXX() methods are invoked. |
void |
preSet()
This method gets invoked before setXXX() methods are called. |
void |
putError(java.lang.String property,
java.lang.String code)
Adds a form error to list of form errors. |
void |
resetErrors()
Remove all form errors from this FormHandler. |
void |
setErrorMessage(java.lang.String s)
|
void |
setFormErrorURL(java.lang.String url)
URL that the FormHandler should redirect to if there is a form error. |
void |
setMessage(java.lang.String s)
A simple property to store a text message. |
void |
setNextURL(java.lang.String url)
|
void |
setPrevURL(java.lang.String url)
|
abstract boolean |
validate()
All subclasses must implement this method. |
boolean |
validate(boolean expr,
java.lang.String property,
java.lang.String code)
Asserts that a particular boolean expression is true, and adds a form error if it is not. |
boolean |
validate(java.lang.String regex,
java.lang.String input,
java.lang.String property,
java.lang.String code)
Validates a form field via a regular expression. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.lang.String myMessage
| Constructor Detail |
public FormHandler()
| Method Detail |
public org.apache.oro.text.perl.Perl5Util getPerl5Util()
public void putError(java.lang.String property,
java.lang.String code)
property - name of the bean property that has an errorcode - a user-defined error code that identifies the errorpublic java.lang.String getError(java.lang.String prop)
public java.lang.String getMessage()
public void setMessage(java.lang.String s)
public void setErrorMessage(java.lang.String s)
public java.lang.String getErrorMessage()
public void resetErrors()
public boolean validate(boolean expr,
java.lang.String property,
java.lang.String code)
public boolean isValid()
public boolean validate(java.lang.String regex,
java.lang.String input,
java.lang.String property,
java.lang.String code)
regular - expression in perl5 syntaxinput - the string to be tested (null values are converted to "")property - the name of the JavaBean propertycode - the user defined code for the error (EMPTY, INVALID_DATE, etc.)public java.lang.String getFormErrorURL()
public void setFormErrorURL(java.lang.String url)
public java.lang.String getPrevURL()
public void setPrevURL(java.lang.String url)
public java.lang.String getNextURL()
public void setNextURL(java.lang.String url)
public javax.servlet.http.HttpServletRequest getRequest()
throws javax.servlet.ServletException
public javax.servlet.http.HttpServletResponse getResponse()
throws javax.servlet.ServletException
public void forwardToFormErrorURL()
throws javax.servlet.ServletException
public void forwardToNextURL()
throws javax.servlet.ServletException
public void forwardToPrevURL()
throws javax.servlet.ServletException
public void forward(java.lang.String s)
throws javax.servlet.ServletException
public void preSet()
public void postSet()
throws javax.servlet.ServletException,
java.io.IOException
public abstract boolean validate()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||