• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem finding resources for default web app

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a problem that I'm sure has been answered at least 100 times, but I just can't find the answer

I have deployed a web application and have configured the ROOT.xml file to use it as the default:



That all works fine, my application come up using either http://www.fubar.foo/myApp, or http://www.fubar.foo. The problem is if I access via http://www.fubar.foo, it doesn't find either my CSS or javascript files. Right now I'm including them like:



What am I doing wrong?

Thanks
Lonnie


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using page-relative addressing. Bad idea. Very bad. As you've discovered.

Use server-relative addressing (starts with context path). There's a JSP FAQ in this subject.
 
Lonnie Lewis
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You are using page-relative addressing. Bad idea. Very bad. As you've discovered.

Use server-relative addressing (starts with context path). There's a JSP FAQ in this subject.



Thanks for the reply. I should have added a little more detail. I started out with:



Which is, I think, the correct way to use context paths. Is this right? If so, what else could be the problem?

When trying to fix the problem, I took out the context pathing stuff which didn't seem to have any affect on the problem.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check the JSP FAQ? The answer is there, waiting for you.
 
Lonnie Lewis
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Did you check the JSP FAQ? The answer is there, waiting for you.



Again, thanks for the reply. Yes, I did look at the FAQ, if this is the one your are talking about: http://faq.javaranch.com/java/ResourceUrlProblems, along with others and they seem to point to the solution that I started out with.



(emphasis on ${request.contextPath})

It seems like my problem is because I'm accessing the application via the default (ROOT.xml). There looks like there was a similar problem here https://coderanch.com/t/414451/JSP/java/fail-include-file-from-upper#1827169

If you are referring to a different FAQ article, please let me know.

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lonnie Lewis wrote:(emphasis on ${request.contextPath})


Yes, that's where the emphasis belongs. Because it's wrong.

You may need to read the FAQ again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic