• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP cannot load the CSS, help!!

 
Kelvin Mak
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I write a Servlet to call a jsp file with RequestDispatcher class, but the jsp cannot load the css style, and I had set no cache in the meta tag. Any one meet this situation?
Here is the code in servlet

thx in advance!
Kelvin
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three questions:
1) what is your servlet mapped as
2) where is the css on the web root
3) how does the JSP refer to the css (ie "../mycss.css" etc)
Dave
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser is trying to use the servlet URL as if it was a directory where the CSS define with a relative URL can be found.
I really like using the BASE tag to define the base URL where a page should look for resources such as CSS, images, sounds, etc.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!