Javascript files in Servlets -Help! - TechRepublic
General discussion
April 24, 2003 at 08:52 PM
roobarb

Javascript files in Servlets -Help!

by roobarb . Updated 22 years, 1 month ago

Help!
Using TOMCAT 4.0.4.
I’m trying to include a javascript file in htm page output for client side validation.
I can do this in JSP the following string in the head section of the htm output:

everything works fine, but if i do the same in a servlet then when i’m in the browser and do something client side that calls functions in the js file i get the browsers “object not found” error.

If i specify a finite path (i.e. E:/mydocs/JSFieldHandler.js)in the servlet (and put the js file in this directory), all is well -but obviously i need to specify a relative path. So, what do i have to specify when using a js file in the servlet. Do i have to put the js files in any special place (i’ve tried putting them in the WEB-INF directory). Is there any special setup required for Tomcat?

This discussion is locked

All Comments