You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pierre Goupil <go...@gmail.com> on 2007/08/01 21:43:00 UTC

including a JavaScript present on my hard disk

Hello all,

I have a very simple question to ask : how do I include a JavaScript file in
a Struts JSP ? I mean : I know how to include it from the Web but I would
like to download it and include it from my hard disk, the first reason of
this being that I'm using SSL. Here is my code :

<script type="text/javascript" src="
http://yui.yahooapis.com/2.2.0/build/yahoo/yahoo-min.js"></script>

But unfortunately, if I put a direct link to my hard disk, it displays it,
instead of just including it into my page for me to be able to call it. The
same applies if the script directive is in the head of my document, FYI.

Cheers,

Pierre


-- 
"Si le sang ne coule pas assez chaud dans tes veines,
je le répandrais sur le sable pour qu'il bouille au soleil."

(Maraxus de Kelde)

Re: including a JavaScript present on my hard disk

Posted by Pierre Goupil <go...@gmail.com>.
It works ! Thank you very much. As we would say in french : "simplicity is
the highest of smartness". ;-)

Regards,

Pierre



2007/8/1, Hassan Schroeder <ha...@gmail.com>:
>
> On 8/1/07, Pierre Goupil <go...@gmail.com> wrote:
>
> > I have a very simple question to ask : how do I include a JavaScript
> file in
> > a Struts JSP ? I mean : I know how to include it from the Web but I
> would
> > like to download it and include it from my hard disk
>
> > But unfortunately, if I put a direct link to my hard disk, it displays
> it,
> > instead of just including it into my page for me to be able to call it.
> The
> > same applies if the script directive is in the head of my document, FYI.
>
> If I understand your use case, not guaranteed :-), something like this
> using JSTL would probably be your best bet.
>
> <script type="text/javascript">
>   <c:import url="file:/home/example/snippet.js"/>
> </script>
>
> Depending on what you're trying to do with the JS, you might run into
> some cross-site-scripting problems...
>
> FWIW!
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Si le sang ne coule pas assez chaud dans tes veines,
je le répandrais sur le sable pour qu'il bouille au soleil."

(Maraxus de Kelde)

Re: including a JavaScript present on my hard disk

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/1/07, Pierre Goupil <go...@gmail.com> wrote:

> I have a very simple question to ask : how do I include a JavaScript file in
> a Struts JSP ? I mean : I know how to include it from the Web but I would
> like to download it and include it from my hard disk

> But unfortunately, if I put a direct link to my hard disk, it displays it,
> instead of just including it into my page for me to be able to call it. The
> same applies if the script directive is in the head of my document, FYI.

If I understand your use case, not guaranteed :-), something like this
using JSTL would probably be your best bet.

<script type="text/javascript">
  <c:import url="file:/home/example/snippet.js"/>
</script>

Depending on what you're trying to do with the JS, you might run into
some cross-site-scripting problems...

FWIW!
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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