You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Leo Asanov <le...@yahoo.com> on 2005/07/27 04:19:13 UTC

Static validation javascript in separate .js file

Hi!

I've tried putting static javascipt into separate .js
file with getStaticJavascript(), and when I load it
with <script src=""> I get javascript error. But if I
save the page and remove "<script..>" at the beginning
and "</script>" at the end of static javascript code
then it works fine. Apparently browser doesn't expect
"<script>" tags in .js files.
Am I doing something wrong?

Cheers,
Leo



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Re: Static validation javascript in separate .js file

Posted by Leo Asanov <le...@yahoo.com>.
Ah, it works! Thanks, Florin! :)

Cheers,
Leo

--- Florin Vancea <fv...@maxiq.ro> wrote:

> As long as you do not have any form, getJavascript()
> in ValidatorTool does
> not generate any dynamic JavaScript.
> 
> Normally, when you get to generate the single
> separate JS for inclusion, you
> do not have any form and therefore you get only the
> static parts.
> 
> This is how I use it and it does work. Check the
> source to see for yourself.
> For what it's worth, the version of ValidatorTool
> I'm using is timestamped
> 23-Feb-2005.
> 
> Yes, getStaticJavascript() looked odd (and useless)
> to me, too, but as long
> as there's a replacement I don't mind it being
> there.
> 
> Florin
> 
> ----- Original Message ----- 
> From: "Leo Asanov" <le...@yahoo.com>
> To: "Velocity Users List"
> <ve...@jakarta.apache.org>
> Sent: Thursday, July 28, 2005 2:36 AM
> Subject: Re: Static validation javascript in
> separate .js file
> 
> 
> > Florin,
> >
> > getJavascript() generates both static and dynamic
> > javascript and it doesn't really make sense to put
> it
> > into separate file because you can't reuse it. I
> > thought that standard way would be to put all
> static
> > javascript (which is huge and doesn't get changed
> from
> > page to page) into separate .js file with
> > getStaticJavascript() and put dynamic javascript
> into
> > specific page with getDynamicJavascript(). At
> least it
> > makes sense to me.
> >
> > Anybody's using getStaticJavascript() at all?
> >
> > Cheers,
> > Leo
> >
> > --- Florin Vancea <fv...@maxiq.ro> wrote:
> >
> > > Use getJavascript() in separate file.
> > >
> > > ----- Original Message ----- 
> > > From: "Leo Asanov" <le...@yahoo.com>
> > > To: <ve...@jakarta.apache.org>
> > > Sent: Wednesday, July 27, 2005 5:19 AM
> > > Subject: Static validation javascript in
> separate
> > > .js file
> > >
> > >
> > > > Hi!
> > > >
> > > > I've tried putting static javascipt into
> separate
> > > .js
> > > > file with getStaticJavascript(), and when I
> load
> > > it
> > > > with <script src=""> I get javascript error.
> But
> > > if I
> > > > save the page and remove "<script..>" at the
> > > beginning
> > > > and "</script>" at the end of static
> javascript
> > > code
> > > > then it works fine. Apparently browser doesn't
> > > expect
> > > > "<script>" tags in .js files.
> > > > Am I doing something wrong?
> > > >
> > > > Cheers,
> > > > Leo
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> ____________________________________________________
> > > > Start your day with Yahoo! - make it your home
> > > page
> > > > http://www.yahoo.com/r/hs
> > > >
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > velocity-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > velocity-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > velocity-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 


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


Re: Static validation javascript in separate .js file

Posted by Florin Vancea <fv...@maxiq.ro>.
As long as you do not have any form, getJavascript() in ValidatorTool does
not generate any dynamic JavaScript.

Normally, when you get to generate the single separate JS for inclusion, you
do not have any form and therefore you get only the static parts.

This is how I use it and it does work. Check the source to see for yourself.
For what it's worth, the version of ValidatorTool I'm using is timestamped
23-Feb-2005.

Yes, getStaticJavascript() looked odd (and useless) to me, too, but as long
as there's a replacement I don't mind it being there.

Florin

----- Original Message ----- 
From: "Leo Asanov" <le...@yahoo.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, July 28, 2005 2:36 AM
Subject: Re: Static validation javascript in separate .js file


> Florin,
>
> getJavascript() generates both static and dynamic
> javascript and it doesn't really make sense to put it
> into separate file because you can't reuse it. I
> thought that standard way would be to put all static
> javascript (which is huge and doesn't get changed from
> page to page) into separate .js file with
> getStaticJavascript() and put dynamic javascript into
> specific page with getDynamicJavascript(). At least it
> makes sense to me.
>
> Anybody's using getStaticJavascript() at all?
>
> Cheers,
> Leo
>
> --- Florin Vancea <fv...@maxiq.ro> wrote:
>
> > Use getJavascript() in separate file.
> >
> > ----- Original Message ----- 
> > From: "Leo Asanov" <le...@yahoo.com>
> > To: <ve...@jakarta.apache.org>
> > Sent: Wednesday, July 27, 2005 5:19 AM
> > Subject: Static validation javascript in separate
> > .js file
> >
> >
> > > Hi!
> > >
> > > I've tried putting static javascipt into separate
> > .js
> > > file with getStaticJavascript(), and when I load
> > it
> > > with <script src=""> I get javascript error. But
> > if I
> > > save the page and remove "<script..>" at the
> > beginning
> > > and "</script>" at the end of static javascript
> > code
> > > then it works fine. Apparently browser doesn't
> > expect
> > > "<script>" tags in .js files.
> > > Am I doing something wrong?
> > >
> > > Cheers,
> > > Leo
> > >
> > >
> > >
> > >
> > >
> > ____________________________________________________
> > > Start your day with Yahoo! - make it your home
> > page
> > > http://www.yahoo.com/r/hs
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>



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


Re: Static validation javascript in separate .js file

Posted by Leo Asanov <le...@yahoo.com>.
Florin, 

getJavascript() generates both static and dynamic
javascript and it doesn't really make sense to put it
into separate file because you can't reuse it. I
thought that standard way would be to put all static
javascript (which is huge and doesn't get changed from
page to page) into separate .js file with
getStaticJavascript() and put dynamic javascript into
specific page with getDynamicJavascript(). At least it
makes sense to me.

Anybody's using getStaticJavascript() at all?

Cheers,
Leo

--- Florin Vancea <fv...@maxiq.ro> wrote:

> Use getJavascript() in separate file.
> 
> ----- Original Message ----- 
> From: "Leo Asanov" <le...@yahoo.com>
> To: <ve...@jakarta.apache.org>
> Sent: Wednesday, July 27, 2005 5:19 AM
> Subject: Static validation javascript in separate
> .js file
> 
> 
> > Hi!
> > 
> > I've tried putting static javascipt into separate
> .js
> > file with getStaticJavascript(), and when I load
> it
> > with <script src=""> I get javascript error. But
> if I
> > save the page and remove "<script..>" at the
> beginning
> > and "</script>" at the end of static javascript
> code
> > then it works fine. Apparently browser doesn't
> expect
> > "<script>" tags in .js files.
> > Am I doing something wrong?
> > 
> > Cheers,
> > Leo
> > 
> > 
> > 
> > 
> >
> ____________________________________________________
> > Start your day with Yahoo! - make it your home
> page 
> > http://www.yahoo.com/r/hs 
> >  
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Static validation javascript in separate .js file

Posted by Florin Vancea <fv...@maxiq.ro>.
Use getJavascript() in separate file.

----- Original Message ----- 
From: "Leo Asanov" <le...@yahoo.com>
To: <ve...@jakarta.apache.org>
Sent: Wednesday, July 27, 2005 5:19 AM
Subject: Static validation javascript in separate .js file


> Hi!
> 
> I've tried putting static javascipt into separate .js
> file with getStaticJavascript(), and when I load it
> with <script src=""> I get javascript error. But if I
> save the page and remove "<script..>" at the beginning
> and "</script>" at the end of static javascript code
> then it works fine. Apparently browser doesn't expect
> "<script>" tags in .js files.
> Am I doing something wrong?
> 
> Cheers,
> Leo
> 
> 
> 
> 
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 


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


Re: Static validation javascript in separate .js file

Posted by Leo Asanov <le...@yahoo.com>.
I've figured this out. The question is what to do with
it? The content is generated by getStaticJavascript()
call, I can't alter it without hacking into the
velocity code.

Cheers,
Leo

--- Robert Zeigler <ro...@scazdl.org> wrote:

> You're right; the browser does /not/ expect <script>
> tags in a .js file;
> it doesn't expect /any/ tags in a .js file, b/c  .js
> file isn't a .html
> file. It's a .js file, so only javascript belongs in
> it.
> 
> 
> Robert
> 
> Leo Asanov wrote:
> > Hi!
> > 
> > I've tried putting static javascipt into separate
> .js
> > file with getStaticJavascript(), and when I load
> it
> > with <script src=""> I get javascript error. But
> if I
> > save the page and remove "<script..>" at the
> beginning
> > and "</script>" at the end of static javascript
> code
> > then it works fine. Apparently browser doesn't
> expect
> > "<script>" tags in .js files.
> > Am I doing something wrong?
> > 
> > Cheers,
> > Leo
> > 
> > 
> > 
> > 		
> >
> ____________________________________________________
> > Start your day with Yahoo! - make it your home
> page 
> > http://www.yahoo.com/r/hs 
> >  
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Static validation javascript in separate .js file

Posted by Robert Zeigler <ro...@scazdl.org>.
You're right; the browser does /not/ expect <script> tags in a .js file;
it doesn't expect /any/ tags in a .js file, b/c  .js file isn't a .html
file. It's a .js file, so only javascript belongs in it.


Robert

Leo Asanov wrote:
> Hi!
> 
> I've tried putting static javascipt into separate .js
> file with getStaticJavascript(), and when I load it
> with <script src=""> I get javascript error. But if I
> save the page and remove "<script..>" at the beginning
> and "</script>" at the end of static javascript code
> then it works fine. Apparently browser doesn't expect
> "<script>" tags in .js files.
> Am I doing something wrong?
> 
> Cheers,
> Leo
> 
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org


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