You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2007/05/10 00:26:52 UTC

Re: [S1] Struts JavaScript Validation staticJavascript generates too much code

Antony Stubbs wrote:
> Having staticJavascript=true generates *all* the validation functions
> specificed in struts-validators.xml (?) even if the form it's generating for
> only uses the REQUIRED validator. 

That's why it's called 'static' :-) Think of it as library code.

> Is there a way to minimise the javascript generated?

Not other than through the technique you describe below.

> I'm going to try a work around, where I've extracted the generated
> javascript, and have put it in an external file that I will reference. Once
> I've decided which functions I am not going to use, I will remove them from
> this file.

That's why the staticJavascript option is there. This is a reasonable 
approach. Do remember to update the contents of the file if and when you 
upgrade to a different Struts release though. Personally I wouldn't 
worry about trimming that file down, since the browser should cache it 
and only have to fetch it the first time it's referenced.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org