• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stylesheet not loading using RequestDispatcher

 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am facing an unusual problem with my web application. It appears that if I forward control from my servlet to a JSP page, then it gets loaded properly with the form elements but the styleSheet doesn't get loaded. As a result, all the font types and colours go awry. Right now to forward to the JSP page I use the following command:


However, I've seen that if I use the following code snippet instead :

the JSP gets loaded properly alongwith the stylesheet.

But my choice of using the former code snippet is 'coz that's the right way to go about if one wants to set/get Attributes set in request object.

Is this problem due to the use of RequestDispatcher or for some other reason?

In the JSP page, the styleSheet is included using the following line within the <head></head> tags:


Are there some special <META> tags needed to be set incase of RequestDispatcher?

A little help.......
[ December 07, 2005: Message edited by: Anirvan Majumdar ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember the brower is going to make a request for the stylesheet (or image or any other linked resource) in a place relative to the address where it thinks your page is. In this case the path in your url-pattern.

Either change the link so it's relative to the address showing in your browser's address window or (better) don't use relative links.
Make them all relative to the root of your app.

 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton! It works fine
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!