Implicit Expression Language Objects

How can I access implicit JSF objects through an expression language?

For example, if I wanted to determine what roles the current director is associated with, how can I do this?

+3
source share
1 answer

If you use JSF on JSP, you can do it the same way as in "plain JSP EL".

#{pageContext.request}

If you use JSF on Facelets, you can omit the part pageContextas you would in "plain JSP EL".

#{request}

In any case, it returns an object HttpServletRequest.

, , isUserInRole(String role). EL. EL JBoss EL.

#{request.isUserInRole(role)}

JBoss EL, jboss-el.jar /WEB-INF/lib web.xml, , Mojarra:

<context-param>     
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
</context-param>
+4

Source: https://habr.com/ru/post/1752907/


All Articles