简体   繁体   English

faces-config.xml中的EL解析器

[英]EL resolver in faces-config.xml

While working on a Spring-JSF integration, I'm seeing this entry in faces-config.xml . 在进行Spring-JSF集成时,我在faces-config.xml看到此条目。

<application>
    <el-resolver>
        org.springframework.web.jsf.el.SpringBeanFacesELResolver
    </el-resolver>
</application>

Can someone explain what exactly <application> and <el-resolver> are? 有人可以解释<application><el-resolver>确切含义吗?

<application> represents the JSF application . <application>代表JSF应用程序 Exactly the one as you can obtain as 正是您可以获得的

Application application = FacesContext.getCurrentInstance().getApplication();

<el-resolver> represents the EL resolver as used by JSF application . <el-resolver>表示JSF应用程序使用EL解析器 Exactly the one as you can obtain as 正是您可以获得的

ELResolver elResolver = application.getELResolver();

What exactly they in turn do can just be read in their javadocs which I've linked above. 反过来,他们可以做什么,也可以在我上面链接的javadocs中阅读。 In a nutshell, the Application basically represents the application-wide JSF configuration and the ELResolver is responsible for evaluating EL expressions in form of #{...} . 简而言之, Application基本上代表了应用程序范围的JSF配置,而ELResolver负责以#{...}形式评估EL表达式。

In case of SpringBeanFacesELResolver , it decorates the underlying EL resolver to recognize Spring managed beans as well based on Spring's own application context and configuration files. 对于SpringBeanFacesELResolver ,它会装饰基础的EL解析器,以基于Spring自己的应用程序上下文和配置文件来识别Spring托管的bean。 In other words, you'll this way be able to use Spring managed beans in JSF pages via EL. 换句话说,您将可以通过EL通过这种方式在JSF页面中使用Spring托管的bean。

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM