webtier@glassfish.java.net

Re: [webtier] Re: JSF 2.0: Handling Relative URLs in Facelets Templates

From: <webtier_at_javadesktop.org>
Date: Thu, 12 Nov 2009 11:16:53 PST

> Try #{request.contextPath}
>
> Lincoln Baxter III

Ah. Silly me. If I used predefined variables, I thought I had to do #{facesContext.externalContext.requestContextPath}. That was so long that I made a custom bean named "context" so I could do #{context.path}. Your shorter form makes my custom bean totally unnecessary. Thanks!

Still, since h:graphicImage, h:outputStylesheet, and h:outputScript have builtin support for context-relative paths, I had thought h:outputLink would too. I guess not. I'll just go with using #{request.contextPath}. Thanks again, Lincoln.

Cheers-
                           - Marty
http://www.coreservlets.com/JSF-Tutorial/jsf2/
[Message sent by forum member 'martyhall' ]

http://forums.java.net/jive/thread.jspa?messageID=371605