| Blog信息 |
|
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7665219 建立时间:2006年5月29日 |

| |
|
[Spring]Spring集成JSF 软件技术, 电脑与网络
lhwork 发表于 2006/6/15 11:15:28 |
| JSF似乎越来越热, Oracle也将ADF贡献给Apache, 作为MyFaces的subprojcet Cherokee.
Spring集成JSF的最简单方式是使用DelegatingVariableResolver类1. web.xml
1500)this.width=500'><context-param> 2500)this.width=500'> <param-name>javax.faces.CONFIG_FILES</param-name> 3500)this.width=500'> <param-value> 4500)this.width=500'> /WEB-INF/faces-config.xml 5500)this.width=500'> </param-value> 6500)this.width=500'> </context-param> 7500)this.width=500'> 8500)this.width=500'> <context-param> 9500)this.width=500'> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>10500)this.width=500'> <param-value>client</param-value>11500)this.width=500'> </context-param>12500)this.width=500'>13500)this.width=500'> <servlet>14500)this.width=500'> <servlet-name>Faces Servlet</servlet-name>15500)this.width=500'> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>16500)this.width=500'> <load-on-startup>1</load-on-startup>17500)this.width=500'> </servlet>18500)this.width=500'>19500)this.width=500'> <servlet-mapping>20500)this.width=500'> <servlet-name>Faces Servlet</servlet-name>21500)this.width=500'> <url-pattern>*.jsf</url-pattern>22500)this.width=500'> </servlet-mapping>
2. faces-config.xml
1500)this.width=500'><!-- Spring VariableResolver for JSF --> 2500)this.width=500'> <application> 3500)this.width=500'> <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver> 4500)this.width=500'> <locale-config> 5500)this.width=500'> <default-locale>zh_CN</default-locale> 6500)this.width=500'> <supported-locale>en</supported-locale> 7500)this.width=500'> <supported-locale>zh_CN</supported-locale> 8500)this.width=500'> </locale-config> 9500)this.width=500'> <message-bundle>messages</message-bundle>10500)this.width=500'> </application>11500)this.width=500'>12500)this.width=500'> <managed-bean>13500)this.width=500'> <managed-bean-name>goodsController</managed-bean-name>14500)this.width=500'> <managed-bean-class>web.jsf.GoodsController</managed-bean-class>15500)this.width=500'> <managed-bean-scope>request</managed-bean-scope>16500)this.width=500'> <!-- inject service -->17500)this.width=500'> <managed-property>18500)this.width=500'> <property-name>goodsService</property-name>19500)this.width=500'> <value>#{goodsService}</value> <!-- inject service -->20500)this.width=500'> </managed-property>21500)this.width=500'> </managed-bean>3. GoodsController.java
1500)this.width=500'>public class GoodsController implements Serializable 2500)this.width=500'>500)this.width=500'>500)this.width=500'>{ 3500)this.width=500'> private GoodsService goodsService; 4500)this.width=500'> 5500)this.width=500'> public void setGoodsService(GoodsService goodsService) 6500)this.width=500'>500)this.width=500'> 500)this.width=500'>{ 7500)this.width=500'> this.goodsService = goodsService; 8500)this.width=500'> } 9500)this.width=500'>10500)this.width=500'> public List getGoodsList() throws Exception11500)this.width=500'>500)this.width=500'> 500)this.width=500'>{12500)this.width=500'> return goodsService.getAll();13500)this.width=500'> }14500)this.width=500'>}参考: spring-framework-1.2.6/docs/reference/html_single/index.html#jsfjsf版的appfuse也是不错的参考sf还有jsf-spring的项目: http://jsf-spring.sourceforge.net/JSF组件List of standard JSF componentshttp://wiki.apache.org/myfaces/JsfComponents
List of custom MyFaces Tomahawk components and extensionshttp://wiki.apache.org/myfaces/MyFacesComponents但感觉navigation-rule的配置好烦, 还有tomahawk的组件用起来不太习惯 (可能是不熟的原因) |
|
|