日期:2014-05-16  浏览次数:20435 次

看图说话:把icesoft加入到jsf+spring+hibernate当中

????? 本文目的,轻松实现ajax组件式编程,并引用轻量级框架完成WEB应用.

????? 开发环境:myeclipse 6.01GA jave ee5? tomcat6.0

???? 组件版本:jsf1.2(呵呵) spring2.0 hibernate3.2 icesoft1.62

第一部分:集成环境测试

?????? 1下载icesoft for myeclipse plugin
????????? 地址: http://www.icefaces.org//main/downloads/os-downloads.iface??

????????? 分别把features和plugins放在myeclipse相应的目录下:???????????

icesoft组件

?????? 2)创建web project

?????? 3)增加JSF框架

????? 4)加入icesoft组件

???? 5)加入SPRING框架

?

???? 6)加入hibernate框架

???? 7)创建一个xhtml页面

???? 8)测试,http://localhost:8090/icesoft/test.iface 可以通过.

第二部分:集成jsf+spring+hibernate

???? 程序基本组织形式:

所有代码见附件.

其中没有包括的代码列表如下:

faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>
	<application>
		<variable-resolver>
			org.springframework.web.jsf.DelegatingVariableResolver
		</variable-resolver>
		<view-handler>
			com.icesoft.faces.facelets.D2DFaceletViewHandler
		</view-handler>
	</application>	
	<managed-bean>
		<managed-bean-name>prtAgeBean</managed-bean-name>
		<managed-bean-class>
			com.antbee.hnds.action.PrtAgeBean
		</managed-bean-class>
		<managed-bean-scope>request</managed-bean-scope>
		<managed-property>
			<property-name>proAgencyDAO</property-name>
			<value>#{proAgencyDAO}</value>
		</managed-property>		
	</managed-bean>
</faces-config>

?web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	id="hnds4">
	<servlet>
		<servlet-name>context</servlet-name>
		<servlet-class>
			org.springframework.web.context.ContextLoaderServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.CONFIG_FILES</param-name>
		<param-value>/WEB-INF/faces-config.xml</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>