• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Referencing Javascript

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My Struts application has all its JSP pages stored under WEB-INF. I want to reference a javascript file inside a JSP file and I'm struggling to get it to work.

At the moment my javascript is in a 'javascript' directory that is at the same level as WEB-INF (under the top level of the web application structure), the action that results in the JSP being sent to the client is of the format "/forms/goMyForm.do" and the script tag looks like this: <script language="javascript" src="javascript/form-rules.js"></script>

The page loads but the JavaScript doesn't work. If I move the javascript code into the JSP everything works fine.

All suggestions appreciated,

Thanks,
Phil.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the problem is that the location of the javascript is not being found. Put tag after <html:html> tag in ur jsp and try. I think this should work.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic