You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/01/09 15:53:12 UTC

DO NOT REPLY [Bug 37580] - [validator] compress javascript

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37580>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37580


niallp@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From niallp@apache.org  2006-01-09 15:53 -------
I have modified the maven build to produce the following compressed JavaScript 
files using the Dojo/Rhino compressor:

1) Compressed versions of individual JavaScript files (e.g. validateInteger-
compress.js) are being generated and packaged in the commons-validator.jar 
along with the standard un-compressed ones.

2) Single files (one compressed, one un-compressed) which merges all the static 
JavaScript files are being produced and included in the binary distro.

http://svn.apache.org/viewcvs?rev=367303&view=rev

In order for the maven build to produce the compressed files the Dojo/Rhino 
compressor jar needs to be downloaded and the build.properies modified to 
include a "dojo_custom_rhino.jar" property pointing to the location of the jar.

Hopefully at some point in the future this can be modified to make it a maven 
dependency.

The single file distros can be used by including the JavaScript file in the 
webapp and using a <script> element to point to the location:

   <script language="JavaScript" type="text/javascript" 
           src="/mywebapp/commons-validator-1.2.1.js"></script>

If you're using Struts, you then simply need to configure the <html:javascript> 
tag to only generate the "dynamic" script and not the "static":

    <html:javascript formName="foo" dynamicJavascript="true"
                                    staticJavascript="false" />

If you want to use the individually compressed JavaScript files packaged in the 
jar, then you need to configure the "jsFunction" element in the validator-
rules.xml to point to the compressed files. For example...

  <validator name="required"
        classname="org.apache.struts.validator.FieldChecks"
           method="validateRequired"
     methodParams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionMessages,
                   org.apache.commons.validator.Validator,
                   javax.servlet.http.HttpServletRequest"
              msg="errors.required"
       jsFunction="org.apache.commons.validator.javascript.validateRequired-
compress"/>

Closing as FIXED

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org