#{facesContext.externalContext.requestContextPath} for request.getContextPath().
You could probably get the rest using
#{facesContext.externalContext.request.scheme} and so on.
However, you're probably better off writing a backing bean to do all
of this for you so you keep all of the logic out of your pages.
#{basePathBackingBean.basePath} which computes and returns the value of
String basePath = request.getScheme() + "://" +
request.getServerName() + ":" + request.getServerPort() +
request.getContextPath() + "/";
You could also do it by defining a facelets function.
Or you could create a custom component that does all of this, and
that'd work for facelets or jsp.
-Mike
On 2/13/06, Yee CN <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi,
>
>
>
> Is there a JSF component for base path? I like to achieve the equivalence of
> the following:
>
>
>
> <% String basePath = request.getScheme() + "://" + request.getServerName() +
>
> ":" + request.getServerPort() + request.getContextPath() + "/";%>
>
>
>
> <link href="<%=basePath%>styles/basic.css" rel="stylesheet"
> type="text/css" />
>
>
>
> I am migrating to facelets and I need to find an equivalent to the above as
> relative path won't work because JSF navigation leaves the URL one step
> behind the actual URL.
>
>
>
> Or is there an alternate to this?
>
>
>
>
>
> Many thanks in advance,
>
>
>
> Best Regards,
>
> Yee