faces-config.xml中的EL解析器 [英] EL resolver in faces-config.xml
问题描述
在进行Spring-JSF集成时,我在faces-config.xml
中看到此条目.
While working on a Spring-JSF integration, I'm seeing this entry in faces-config.xml
.
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
</application>
有人可以解释<application>
和<el-resolver>
的确切含义吗?
Can someone explain what exactly <application>
and <el-resolver>
are?
推荐答案
<application>
represents the JSF application. Exactly the one as you can obtain as
Application application = FacesContext.getCurrentInstance().getApplication();
<el-resolver>
将 EL解析器表示为由JSF应用程序使用.正是您可以获得的那个
<el-resolver>
represents the EL resolver as used by JSF application. Exactly the one as you can obtain as
ELResolver elResolver = application.getELResolver();
反过来,他们到底可以做什么,可以在我上面链接的javadocs中进行阅读.简而言之,Application
基本上代表了应用程序范围内的JSF配置,而ELResolver
负责以#{...}
的形式评估EL表达式.
What exactly they in turn do can just be read in their javadocs which I've linked above. In a nutshell, the Application
basically represents the application-wide JSF configuration and the ELResolver
is responsible for evaluating EL expressions in form of #{...}
.
在SpringBeanFacesELResolver
的情况下,它会装饰底层的EL解析器,以基于Spring自己的应用程序上下文和配置文件识别Spring托管的bean.换句话说,您将可以通过EL这样在JSF页面中使用Spring托管的bean.
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. In other words, you'll this way be able to use Spring managed beans in JSF pages via EL.
这篇关于faces-config.xml中的EL解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!