Can't include .js file on jsp page controlled by front controller servlet
pankaj patil
Ranch Hand
Joined: Dec 19, 2004
Posts: 98
posted
0
i have a jsp page which is been forwarded from servlet using requet dispatcher
And in that jsp i have included js file using <script langauge="javascript" src="../script/util.js"/>
but the js is not getting loaded.Jsp page gives error when i call any of the function defined in the util.js file
Can any one help me out for same
regards
Pankaj
This message was edited 1 time. Last update was at by Bear Bibeault
Regards,
Pankaj Patil
Bear Bibeault
Author and opinionated walrus
Marshal
Pankaj, what everyone is trying to tell you here is that don't use a relative path to point to your script. Use an absolute path starting from the context path. You can use EL to get the context path. Its something like this
The relative syntax will work on the basis of the request URL. If your relative path is correct on the basis of the location of the JSP, that doesn't mean that it will work...
You can also use the HTML base tag to aid you. Specify the absolute path of the script file in question to avoid confusion. Use a browser based debugger like firebug to check for broken links to the JS