StartupBeans

UI Components for JSF
Post Reply
timothy.yip
Posts: 16
Joined: 11 Oct 2009, 19:15

15 Oct 2009, 14:35

Hi,

Ultimately I'm creating my navigation menu on facelet template and I need to populate the context root dynamically.

With jsp I can do something along the lines of <% context.getcontextpath %>, but facelet can't do this (I think).

I have a application scope bean that contains most system property, using Optimus @Controller(name = "DefaultStartUpBean", scope = Scope.APPLICATION, startup = true). Problem is, because this class is initialised at deployment, there is no FacesContext so I can't access the ServletContext to get the context path.

Any thoughts on how I should approach this?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

15 Oct 2009, 14:54

With facelets this should work;

Code: Select all

#{request.contextPath}

timothy.yip
Posts: 16
Joined: 11 Oct 2009, 19:15

15 Oct 2009, 15:33

Oh thanks!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests