Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem finding resources for default web app

 
Lonnie Lewis
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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 http://www.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
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic