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

Reply via email to