将JSF与Spring集成 [英] Integrating JSF with Spring

查看:101
本文介绍了将JSF与Spring集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有实现任何代码,我仍在使用新应用程序的整体架构,这将是我第一次使用 JSF + Spring。

I haven't implemented any code, I'm still working the overall architecture for a new application and this going to be the first time I use JSF+Spring.

我需要将Web服务放在Spring服务bean(业务逻辑层)之前,因为除了表示层之外,其他应用程序可以访问这些bean。在为应用程序定义不同的层或层时,我不确定如何将JSF(表示层)与Spring(此应用程序中的业务层)集成。

I need to put web services in front of the Spring service beans (business logic tier) since these beans could be accessed by other applications besides the presentation tier. While defining the different layers or tiers for the application, I feel unsure about how to integrate JSF (the presentation tier) with Spring (the business tier in this application).

我正在考虑定义某种公共层或服务层,以便为JSF和Spring提供粘合代码,但在此之前我想听听别人他们做了什么或是否有使用其他框架来帮助解决这个场景的粘合代码(我已经检查了Spring MVC / Spring Faces,但是我不确定这是否是我需要的,因为我认为这个应用程序更像是以JSF为中心而不是以Spring为中心,但也许你可以帮我考虑另一种方法。)

I'm considering to define some sort of common tier or service tier in order to provide the glue code for JSF and Spring, but before that I want to hear from others what have they done or if they have used other frameworks to help with the glue code for this scenario (I already checked Spring MVC/Spring Faces, but I'm not sure if that's what I need since I'm thinking of this application more like JSF-centric than Spring-centric, but maybe you could help me about considering another approach).

提前致谢。

推荐答案

glue是spring ELResolver ,您必须在 faces-config.xml

The "glue" is the spring ELResolver, which you must configure in your faces-config.xml:

<application>    
    <!--
        This is the JSF 1.2 ELResolver that delegates to the Spring root
        WebApplicationContext resolving name references to Spring-defined
        beans.
    -->
    <el-resolver>
         org.springframework.web.jsf.el.SpringBeanFacesELResolver
    </el-resolver>
 </application>

这意味着每个#{bean.property} 通过在spring上下文中解析 bean 来处理。

This means that each #{bean.property} is handled by the resolving the bean in the spring context.

这篇关于将JSF与Spring集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆