[ https://issues.apache.org/jira/browse/VALIDATOR-262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved VALIDATOR-262. ---------------------------- Resolution: Won't Fix Javascript routines are no longer maintained and have been deprecated > Expose JsFunction property in ValidatorAction > --------------------------------------------- > > Key: VALIDATOR-262 > URL: https://issues.apache.org/jira/browse/VALIDATOR-262 > Project: Commons Validator > Issue Type: Improvement > Components: JavaScript > 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 was sent by Atlassian JIRA (v6.3.4#6332)