You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jeff Tsay (JIRA)" <ji...@apache.org> on 2008/04/27 02:36:55 UTC

[jira] Updated: (VALIDATOR-262) Expose JsFunction property in ValidatorAction

     [ https://issues.apache.org/jira/browse/VALIDATOR-262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Tsay updated VALIDATOR-262:
--------------------------------

    Description: 
Exposing the JsFunction property in ValidatorAction would make it possible for other tools to include Javascript routines as external scripts, inside of inline Javascript in an HTML page. This would reduce the size of pages containing client-side validation and the overall size of content transferred from server to browser.

Shale commons validator integration uses commons validator to provide both client side and server side mapping. When the JSF renderer writes the validation Javascript code, it looks up the ValidatorAction for each validation routine. It then inserts the Javascript inline using ValidatorAction.getJavascript(). Since this code never changes and is likely to be used multiple times, I would like to instead insert something like this:

<script src="/weblets/validator/validateEmail.js" />

I can almost do this with Shale commons validator and Weblets, but I need to get the fully qualified resource name from the ValidatorAction, i.e. JsFunction. I can then map the resource name (org.apache.commons.validator.javascript.validateEmail) to a URL ("/weblets/validator/validateEmail.js") using Weblets. 

The entire change required is adding:

/**
     * Gets the fully qualified class path of the Javascript function.
     * This is optional and can be used instead of the Javascript property. 
     * 
     * @return The Javascript function's fully qualified class path, or
     * null if this property has not been set.
     */    
    public String getJsFunction() {
        return jsFunction;            
    }

to ValidatorAction.java.

After the change above, I am able output <script src=""> tags in Shale commons validator.

The change could also be used in other web frameworks to do the same thing. 

  was:
Exposing the JsFunction property in ValidatorAction would make it possible for other tools to include Javascript routines as external scripts, inside of inline Javascript in an HTML page. This would reduce the size of pages containing client-side validation and the overall size of content transferred from server to browser.

Shale commons validator integration uses commons validator to provide both client side and server side mapping. When the JSF renderer writes the validation Javascript code, it looks up the ValidatorAction for each validation routine. It then inserts the Javascript inline using ValidatorAction.getJavascript(). Since this code never changes and is likely to be used multiple times, I would like to instead insert something like this:

<script src="/weblets/validator/validateEmail.js" />

I can almost do this with Shale commons validator and Weblets, but I need to get the fully qualified resource name from the ValidatorAction, i.e. JsFunction. I can then map the resource name (com.ngweb.jsf.xul.validator.javascript.validateEmail) to a URL ("/weblets/validator/validateEmail.js") using Weblets. 

The entire change required is adding:

/**
     * Gets the fully qualified class path of the Javascript function.
     * This is optional and can be used instead of the Javascript property. 
     * 
     * @return The Javascript function's fully qualified class path, or
     * null if this property has not been set.
     */    
    public String getJsFunction() {
        return jsFunction;            
    }

to ValidatorAction.java.

After the change above, I am able output <script src=""> tags in Shale commons validator.

The change could also be used in other web frameworks to do the same thing. 


> Expose JsFunction property in ValidatorAction
> ---------------------------------------------
>
>                 Key: VALIDATOR-262
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-262
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 1.3.1 Release
>         Environment: Any
>            Reporter: Jeff Tsay
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Exposing the JsFunction property in ValidatorAction would make it possible for other tools to include Javascript routines as external scripts, inside of inline Javascript in an HTML page. This would reduce the size of pages containing client-side validation and the overall size of content transferred from server to browser.
> Shale commons validator integration uses commons validator to provide both client side and server side mapping. When the JSF renderer writes the validation Javascript code, it looks up the ValidatorAction for each validation routine. It then inserts the Javascript inline using ValidatorAction.getJavascript(). Since this code never changes and is likely to be used multiple times, I would like to instead insert something like this:
> <script src="/weblets/validator/validateEmail.js" />
> I can almost do this with Shale commons validator and Weblets, but I need to get the fully qualified resource name from the ValidatorAction, i.e. JsFunction. I can then map the resource name (org.apache.commons.validator.javascript.validateEmail) to a URL ("/weblets/validator/validateEmail.js") using Weblets. 
> The entire change required is adding:
> /**
>      * Gets the fully qualified class path of the Javascript function.
>      * This is optional and can be used instead of the Javascript property. 
>      * 
>      * @return The Javascript function's fully qualified class path, or
>      * null if this property has not been set.
>      */    
>     public String getJsFunction() {
>         return jsFunction;            
>     }
> to ValidatorAction.java.
> After the change above, I am able output <script src=""> tags in Shale commons validator.
> The change could also be used in other web frameworks to do the same thing. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.