rvabdn
rvabdn

Reputation: 967

How to include .js file in google app engine project

I have a .jsp page as the frontend of my app. I need to include a seperate .js file in that page.

my directories look like this

src
|--->com.stuff
     |--->servlet.java
war
|-->WEB-INF
    |--->pages
         |---->page.jsp
               include.js

From my java servlet I call

RequestDispatcher jsp = req.getRequestDispatcher("/WEB-INF/pages/page.jsp");

which works fine but in page.jsp I have this

<!DOCTYPE html>
<html>
    <head>
        <title>Page</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"type="text/javascript" ></script>
        <script src="./include.js" type="text/javascript" ></script>

    </head>
    <body>
        <h1>Page</h1>
    </body>
</html>

I've tried a few differnet things in place of "./include.js" and I always get an error from firebug saying

"NetworkError: 404 Not Found - http://localhost:8888/include.js"

Upvotes: 0

Views: 1321

Answers (1)

Tim Hoffman
Tim Hoffman

Reputation: 12986

Have you read the docs on "Using Static Files" https://developers.google.com/appengine/docs/java/gettingstarted/staticfiles

You should!

It explicitly states "By default, App Engine makes all files in the WAR available as static files except JSPs and files in WEB-INF/."

And your include.js is inside WEB-INF/

Upvotes: 2

Related Questions