Spring集成JSF的最简单方式是使用DelegatingVariableResolver类
2007-12-02 22:44
633 查看
Spring集成JSF的最简单方式是使用DelegatingVariableResolver类
faces-config.xml
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- Spring VariableResolver for JSF -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<application>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<locale-config>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<default-locale>zh_CN</default-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<supported-locale>en</supported-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<supported-locale>zh_CN</supported-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</locale-config>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<message-bundle>messages</message-bundle>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</application>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-name>goodsController</managed-bean-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-class>web.jsf.GoodsController</managed-bean-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-scope>request</managed-bean-scope>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- inject service -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property-name>goodsService</property-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>#{goodsService}</value> <!--注入Spring service -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</managed-property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</managed-bean>
GoodsController.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class GoodsController implements Serializable
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private GoodsService goodsService;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void setGoodsService(GoodsService goodsService)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.goodsService = goodsService;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public List getGoodsList() throws Exception
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return goodsService.getAll();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
faces-config.xml
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- Spring VariableResolver for JSF -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<application>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<locale-config>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<default-locale>zh_CN</default-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<supported-locale>en</supported-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<supported-locale>zh_CN</supported-locale>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</locale-config>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<message-bundle>messages</message-bundle>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</application>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-name>goodsController</managed-bean-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-class>web.jsf.GoodsController</managed-bean-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-bean-scope>request</managed-bean-scope>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- inject service -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<managed-property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property-name>goodsService</property-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<value>#{goodsService}</value> <!--注入Spring service -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</managed-property>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</managed-bean>
GoodsController.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class GoodsController implements Serializable
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private GoodsService goodsService;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void setGoodsService(GoodsService goodsService)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.goodsService = goodsService;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public List getGoodsList() throws Exception
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return goodsService.getAll();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
相关文章推荐
- Mybatis3.2.1使用例三:Mapper方式集成Spring、配置文件提供SQL
- MongoDB的使用学习之(五)Spring集成MongoDB以及简单的CRUD
- spring集成:如何用传统方式使用fastDFSClient
- Spring Boot(1)集成MyBatis的简单使用
- 从零学spring boot--集成mybatis--项目--使用注解方式
- Quartz资源及与Spring集成简单使用举例
- jersey的简单介绍及与spring-boot的集成使用
- 关于spring与struts2使用Annotion注解方式的集成
- Mongodb安装、简单使用及与spring的集成
- 使用buffalo集成spring写的一个简单的登录子模块
- spring 4.0 AOP (使用AspectJ的注解方式 的aop实现)简单实例
- memcached的简单使用以及spring的集成
- Spring注解方式集成Kafka(spring-kafka的使用)
- dubbox在异构系统中的使用-集成mybatis全注解方式到spring
- spring 4.0 AOP (使用AspectJ的注解方式 的aop实现)简单实例
- Spring 和JSF的集成的一种方式
- Spring注解方式集成Kafka(spring-kafka的使用)
- JSF和Spring集成2--简单配置
- 注解方式在Spring环境下执行Testcase的简单使用
- Redis+Spring集成使用简单介绍