You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tony Santinello <sa...@yahoo.com> on 2005/12/08 17:42:26 UTC
Validator and Javascript
Hi,
I'm using Struts 1.2.7 and I'm using commons-validator
to validate my forms. Can someone tell me why
validator includes all the javascript functions when
rendering the jsp page?
Even including javascript functions that I'm not using
in validation.xml, such as creditcard validation or
integer validation?
Is there anyway to include just the javascript my jsp
needs and not all the extra javascript?
Thanks
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validator and Javascript
Posted by Srinivas Jadcharla <jd...@gmail.com>.
I think Validator Framework internally uses Javascript..You can customise
according to you Requirement..Some one correct me if iam wrong..
On 12/8/05, Tony Santinello <sa...@yahoo.com> wrote:
>
> Hi,
>
> I'm using Struts 1.2.7 and I'm using commons-validator
> to validate my forms. Can someone tell me why
> validator includes all the javascript functions when
> rendering the jsp page?
>
> Even including javascript functions that I'm not using
> in validation.xml, such as creditcard validation or
> integer validation?
>
> Is there anyway to include just the javascript my jsp
> needs and not all the extra javascript?
>
> Thanks
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Thanks & Regards
Srinivas
732-648-9421(Cell)
Re: Validator and Javascript
Posted by Laurie Harper <la...@holoweb.net>.
From the documentation:
"The dynamicJavascript and staticJavascript attributes default to
true, but if dynamicJavascript is set to true and staticJavascript is
set to false then only the dynamic JavaScript will be rendered. If
dynamicJavascript is set to false and staticJavascript is set to true
then only the static JavaScript will be rendered which can then be put
in separate JSP page so the browser can cache the static JavaScript."
So, you can create a 'validation.jsp' containing <html:javascript
staticJavascript='true' dynamicJavascript='false'/> and reference this
JSP with a <script/> tag in any JSP which uses validation -- or you can
save the result of processing validation.jsp into a static file and
reference that, to avoid the JSP processing for the static content.
L.
Deepa Khetan wrote:
> I dint understand how to copy the static javascript on the validator.xml to
> another .js file? Can u please elaborate?
>
> On 12/10/05, Laurie Harper <la...@holoweb.net> wrote:
>> Tony Santinello wrote:
>>> Hi,
>>>
>>> I'm using Struts 1.2.7 and I'm using commons-validator
>>> to validate my forms. Can someone tell me why
>>> validator includes all the javascript functions when
>>> rendering the jsp page?
>>>
>>> Even including javascript functions that I'm not using
>>> in validation.xml, such as creditcard validation or
>>> integer validation?
>>>
>>> Is there anyway to include just the javascript my jsp
>>> needs and not all the extra javascript?
>> There's two types of Javascript emitted by the validator framework:
>> static and dynamic. The static script includes all the code that doesn't
>> vary from form to form, whereas the dynamic stuff is dependent on the
>> validations you've configured for the form.
>>
>> The html:javascript, by default, emits all the static code every time
>> and generates additional dynamic code appropriate to the form. You can
>> tell it not to emit the static Javascript at all (in which case you need
>> to include it elsewhere on the page, directly or by reference), but you
>> can't tell it to emit only a sub-set of the static code.
>>
>> Your best bet is to copy the static Javascript into a seperate .js file,
>> include that in the head of your page, and turn it off in the
>> html:javascript tag. Browser caching will then avoid the user having to
>> download the static code everytime, which is one step better than
>> inlining a sub-set of it.
>>
>> L.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validator and Javascript
Posted by Deepa Khetan <de...@gmail.com>.
I dint understand how to copy the static javascript on the validator.xml to
another .js file? Can u please elaborate?
On 12/10/05, Laurie Harper <la...@holoweb.net> wrote:
>
> Tony Santinello wrote:
> > Hi,
> >
> > I'm using Struts 1.2.7 and I'm using commons-validator
> > to validate my forms. Can someone tell me why
> > validator includes all the javascript functions when
> > rendering the jsp page?
> >
> > Even including javascript functions that I'm not using
> > in validation.xml, such as creditcard validation or
> > integer validation?
> >
> > Is there anyway to include just the javascript my jsp
> > needs and not all the extra javascript?
>
> There's two types of Javascript emitted by the validator framework:
> static and dynamic. The static script includes all the code that doesn't
> vary from form to form, whereas the dynamic stuff is dependent on the
> validations you've configured for the form.
>
> The html:javascript, by default, emits all the static code every time
> and generates additional dynamic code appropriate to the form. You can
> tell it not to emit the static Javascript at all (in which case you need
> to include it elsewhere on the page, directly or by reference), but you
> can't tell it to emit only a sub-set of the static code.
>
> Your best bet is to copy the static Javascript into a seperate .js file,
> include that in the head of your page, and turn it off in the
> html:javascript tag. Browser caching will then avoid the user having to
> download the static code everytime, which is one step better than
> inlining a sub-set of it.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Validator and Javascript
Posted by Laurie Harper <la...@holoweb.net>.
Tony Santinello wrote:
> Hi,
>
> I'm using Struts 1.2.7 and I'm using commons-validator
> to validate my forms. Can someone tell me why
> validator includes all the javascript functions when
> rendering the jsp page?
>
> Even including javascript functions that I'm not using
> in validation.xml, such as creditcard validation or
> integer validation?
>
> Is there anyway to include just the javascript my jsp
> needs and not all the extra javascript?
There's two types of Javascript emitted by the validator framework:
static and dynamic. The static script includes all the code that doesn't
vary from form to form, whereas the dynamic stuff is dependent on the
validations you've configured for the form.
The html:javascript, by default, emits all the static code every time
and generates additional dynamic code appropriate to the form. You can
tell it not to emit the static Javascript at all (in which case you need
to include it elsewhere on the page, directly or by reference), but you
can't tell it to emit only a sub-set of the static code.
Your best bet is to copy the static Javascript into a seperate .js file,
include that in the head of your page, and turn it off in the
html:javascript tag. Browser caching will then avoid the user having to
download the static code everytime, which is one step better than
inlining a sub-set of it.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org