• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

webapp can't find static content

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My struts webapp is deployed with file serving enabled = false
Static references in my jsps are relative: e.g.
script language="javascript1.2" src="/js/globals.js"

Jsps are in the root directory for webcontent
Static content is on a sep. http server in:
htdocs/en_US/js/global.js
if I'm not getting my static content displayed, is it because:
a) relative path is wrong - I need actual path? how do I calculate this?
b) path is worng on http server? needs servlet context somehow?
b) server-plugins are wrong?
thanks
Max
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Max,
HTTP clients have no notion of "context paths", so when they see "/js/something.js", they try and fetch exactly that. Have you tried to use javax.servlet.http.HttpServletRequest.getContextPath() to write out paths dynamically? That may be what you are looking for.
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathanial-
But don't I need to path for the HTTP server, not servlet context?
thanks
Max
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic