You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Pat <cp...@yahoo.com> on 2007/09/11 00:23:16 UTC

tc & xmlhttprequest

Hello
Any tips on serving a ajax page with tomcat?  I am now calling the page with a jsp:forward outside of the web-inf.  Do I also have to fully unc path to the *.js files, like src=localhost:8080/context/intPages/myScripts.js ?

Re: tc & xmlhttprequest

Posted by Chris Pat <cp...@yahoo.com>.
Hi David
Thanks this is EXACTLY the syntax I was looking for and doing precisely what I expect.  

David Smith <dn...@cornell.edu> wrote: If you are linking from inside a jsp page and using jsp spec 1.2+ / 
servlet spec 2.4+, you can do this:


src="${request.contextPath}/intPages/myScripts.js">

The comment is there if you are using xml valid jsp to prevent tomcat 
from collapsing the script tag and breaking it in IE.

The EL expression ${request.contextPath} fetches the context path live 
so you don't have to hard code.  Otherwise this is a server relative 
path and the client will automagically add the 
http://[servername]:[port] part.

--David


Chris Pat wrote:
> Hello
> Any tips on serving a ajax page with tomcat?  I am now calling the page with a jsp:forward outside of the web-inf.  Do I also have to fully unc path to the *.js files, like src=localhost:8080/context/intPages/myScripts.js ?
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



Re: tc & xmlhttprequest

Posted by David Smith <dn...@cornell.edu>.
If you are linking from inside a jsp page and using jsp spec 1.2+ / 
servlet spec 2.4+, you can do this:

<script type="text/javascript" 
src="${request.contextPath}/intPages/myScripts.js"><!-- --></script>

The comment is there if you are using xml valid jsp to prevent tomcat 
from collapsing the script tag and breaking it in IE.

The EL expression ${request.contextPath} fetches the context path live 
so you don't have to hard code.  Otherwise this is a server relative 
path and the client will automagically add the 
http://[servername]:[port] part.

--David


Chris Pat wrote:
> Hello
> Any tips on serving a ajax page with tomcat?  I am now calling the page with a jsp:forward outside of the web-inf.  Do I also have to fully unc path to the *.js files, like src=localhost:8080/context/intPages/myScripts.js ?
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org