日期:2014-05-16 浏览次数:20452 次
1、在WEB-INF中的web.xml中配置相应Spring及JSF配置文件的位置:
?
<servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value> /WEB-INF/facesConfig/faces-config.xml, /WEB-INF/facesConfig/faces-config-device.xml, /WEB-INF/facesConfig/faces-config-event.xml, /WEB-INF/facesConfig/faces-config-config.xml, /WEB-INF/facesConfig/faces-config-system.xml, /WEB-INF/facesConfig/faces-config-monitor.xml, /WEB-INF/facesConfig/faces-config-topo.xml, </param-value> </context-param> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:springConfig/*.xml, classpath:com/network/manage/topo/springconfig/applicationContext-topo.xml, classpath:com/network/manage/system/springconfig/applicationContext-system.xml, /WEB-INF/classes/com/network/manage/base/app/event/springconfig/appContextBaseEvent.xml, /WEB-INF/classes/com/network/manage/base/app/perf/springconfig/appContextBasePerf.xml, /WEB-INF/classes/com/network/manage/base/app/report/springconfig/appContextBaseReport.xml, /WEB-INF/classes/com/network/manage/base/app/system/springconfig/appContextBaseSystem.xml, /WEB-INF/classes/com/network/manage/common/connection/snmp/community/springconfig/appContextCommonSnmpCommunity.xml, /WEB-INF/classes/com/network/manage/common/exception/springconfig/appContextCommonException.xml, /WEB-INF/classes/com/network/manage/common/log/springconfig/appContextCommonLog.xml, /WEB-INF/classes/com/network/manage/common/timer/springconfig/appContextCommonTimer.xml, /WEB-INF/classes/com/network/manage/base/app/topo/springconfig/appContextBaseTopo.xml </param-value> </context-param>
?
2、spring配置文件中配置相应的service/logic 及 dao :applicationContext-system.xml
<bean id="UserBean" class="com.network.manage.system.bo.UserBean"> </bean> <bean id="userDao" class="com.network.manage.system.dao.impl.UserDaoImp"> <property name="sessionFactory"> <ref bean="SpringSessionFactory" /> </property> </bean> <bean id="topoAreaDao" class="com.network.manage.topo.dao.TopoAreaDaoImp"> <property name="sessionFactory"> <ref bean="SpringSessionFactory" /> </property> </bean> <bean id="UserService" class="com.network.manage.system.logic.UserServiceImp"> <property name="dao"> <ref bean="userDao" /> </property> <property name="topoAreaDao"> <ref bean="topoAreaDao" /> </property> </bean>
?
3、jsf配置文件:faces-config-system.xml
??? 配置:跳转、action、action中的service及dao
<!-- 系统管理 模块 各Main页面跳转 开始 --> <navigation-case> <from-outcome>userManageMain</from-outcome> <to-view-id>/system/userManageMain.xhtml</to-view-id> </navigation-case> <navigation-case> <from-outcome>roleManageMain</from-outcome> <to-view-id>/system/roleManageMain.xhtml</to-view-id> </navigation-case> <navigation-case> <from-outcome>logManageMain</from-outcome> <to-view-id>/system/logManageMain.xhtml</to-view-id> </navigation-case> <!-- 系统管理 模块 各Main页