Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

spring - EL resolver in 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>

Can someone explain what exactly <application> and <el-resolver> are?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

<application> represents the JSF application. Exactly the one as you can obtain as

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

<el-resolver> represents the EL resolver as used by JSF application. 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. In a nutshell, the Application basically represents the application-wide JSF configuration and the ELResolver is responsible for evaluating EL expressions in form of #{...}.

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.

See also:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...