org.springmodules.validation.valang.javascript.taglib
Class ValangValidateTag

java.lang.Object
  extended by RequestContextAwareTag
      extended by org.springmodules.validation.valang.javascript.taglib.ValangValidateTag

public class ValangValidateTag
extends RequestContextAwareTag

Generates JavaScript validation code from a set valang validation rules. The generated code requires a set of JavaScript objects to have been placed into the page either by using the ValangCodebaseTag or by directly including the code from the file "valang_codebase.js" located in the org.springmodules.validation.valang.javascript package.

It is expected that the validation rules to be translated are placed into the model using one of the methods from ValangJavaScriptTagUtils or using the Spring MVC interceptor ValangRulesExportInterceptor, however it is not required that rules be placed into the model to use this tag.

If the tag has any body content this will be interpreted as a set of additional valang rules that will be appended to the set of rules located for the provided command name; or if no command name is specified the translated body content will be used to provide all rules.

NOTE: this tag must be placed inside the HTML form tags that the validation rules are expected to apply too; failure to do this will result in a JavaScript exception being thrown when the page loads.

Author:
Oliver Hutchison

Field Summary
static java.lang.String VALANG_RULES_KEY_PREFIX
          Prefix which, when appended with a command name, is used to identify valang validation rules placed into the model.
 
Constructor Summary
ValangValidateTag()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 void doFinally()
           
 void doInitBody()
           
protected  int doStartTagInternal()
           
protected  java.util.Collection getRulesForCommand()
           
protected  java.util.Collection parseRulesFromBodyContent()
           
 void setBodyContent(BodyContent bodyContent)
           
 void setCommandName(java.lang.String commandName)
          Sets the name of the command which will be validated by the generated JavaScript.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALANG_RULES_KEY_PREFIX

public static final java.lang.String VALANG_RULES_KEY_PREFIX
Prefix which, when appended with a command name, is used to identify valang validation rules placed into the model.

See Also:
Constant Field Values
Constructor Detail

ValangValidateTag

public ValangValidateTag()
Method Detail

setCommandName

public void setCommandName(java.lang.String commandName)
Sets the name of the command which will be validated by the generated JavaScript. If this value is specified it is expected that a collection of valang rules for the specified command name have been placed in the model using one of the methods from ValangJavaScriptTagUtils.

See Also:
ValangJavaScriptTagUtils.addValangRulesToModel(BaseCommandController, Map), ValangJavaScriptTagUtils.addValangRulesToModel(String, ValangValidator, Map)

doStartTagInternal

protected int doStartTagInternal()

doInitBody

public void doInitBody()

setBodyContent

public void setBodyContent(BodyContent bodyContent)

doAfterBody

public int doAfterBody()
                throws JspException
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
Throws:
JspException

parseRulesFromBodyContent

protected java.util.Collection parseRulesFromBodyContent()
                                                  throws JspException
Throws:
JspException

getRulesForCommand

protected java.util.Collection getRulesForCommand()

doFinally

public void doFinally()


Copyright © 2005. All Rights Reserved.