I tried that too. i renamed it to hellojs.jsp (since i have a hello.jsp already) and used: <script src="hellojs.jsp"> but same thing. the thing is that if i use JSP include to include the jsp file for the scripts. I might as well just put the script inside the actual page again no? I want to keep it in a separate js file so that I can take advantage of js caching since the values wont change. Thanx, -Tim
-----Original Message----- From: Campano, Troy [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: Re: JSP Code in a JS file I don't think they do. Have you tried giving your external JS file a JSP extension? If that doesn't work then try a JSP include to include the JS file with the JSP extension. Just an idea. thanks! -----Original Message----- From: Chen, Gin [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 2:27 PM To: [EMAIL PROTECTED] Subject: JSP Code in a JS file Hi all, I've checked the archives because I thought this was already answered but I cant find the anything regarding it. I had JSP Code inside of a <script> tag so that I could use server side variables when building my javascript. ex: //hello.jsp ... <script> function sayHi() { alert( '<%= "Hi" %>'); } </script> That worked fine. But I tried to move it into its own .js file and now it doesnt work. I tried to do: //hello.js function sayHi() { alert( '<%= "Hi" %>'); } //hello.jsp ... <script src="hello.js"></script> and got a syntex error exception I then tried to do: //hello.js function sayHi() { alert( 'Hi' ); } and it works fine. Does .js files not execute jsp code? -Tim =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
