Feature request: easily access context / application properties in EL #311

Closed
jepsar opened this Issue Sep 15, 2016 · 3 comments

Projects

None yet

2 participants

@jepsar
jepsar commented Sep 15, 2016

I was writing this expression in a rendered attribute: #{facesContext.application.projectStage == 'Development'}. Then I remembered Faces#isDevelopment() and wondered if OmniFaces also offered a way to easily access this in EL. Could not find anything. In my project I'll be creating a bean to expose Faces#isDevelopment().

@BalusC
Member
BalusC commented Sep 17, 2016 edited

One way is <o:importFunctions>.

<o:importFunctions type="org.omnifaces.util.Faces" />
<h:someComponent rendered="#{Faces:isDevelopment()}" />

I however do agree that something like a #{faces.development} would be useful. This is definitely possible with a custom ELResolver which delegates further to Faces utility class, so I'll keep the issue open.

@jepsar
jepsar commented Sep 19, 2016

Thanks! +1 for o:importFuctions I'll be using that.

@BalusC BalusC added a commit that closed this issue Sep 25, 2016
@BalusC BalusC Fix #311: add FacesELResolver 14e6db2
@BalusC BalusC closed this in 14e6db2 Sep 25, 2016
@BalusC
Member
BalusC commented Sep 25, 2016 edited

#{faces} is now available with among others #{faces.development}.

It's available in today's latest 2.6-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment