Wayne Fay wrote:
Maybe your page is in a subfolder, so on the next page the path to the
stylesheet  has  a  wrong base. Try to change the path to the css file
to an absolute path instead of a relative one.

I have had numerous problems with stylesheets in JSF.

The only way I could get things to work consistently was with absolute
paths, as Steffen has already suggested.

Remember that the *browser* fetches the stylesheet by passing an *absolute* URL to the remote server.

When the stylesheet URL is relative, the *browser* forms an absolute URL for it by taking the URL it used *to fetch the current html page*, and appending the relative stylesheet path.

Any server-side framework that uses forwards internally is going to have problems with this, because the browser doesn't know the actual *file path* for the jsp (or whatever) that was forwarded to in order to generate the response page, it only knows the original URL it sent.

For just about any dynamic server stuff you therefore *must* ensure the page returned to the browser contains *absolute* URLs in it. There are special Struts JSP tags to help with this; I'm sure PHP and similar also have helpers to turn relative paths into absolute paths.

It looks to me like the tomahawk t:stylesheet tag currently just adds the webapp context to the path, but doesn't handle paths relative to the current JSP.

Regards,

Simon

Reply via email to