使用netbeans搭建jsf+spring框架的方法
發(fā)布時(shí)間:2014-04-23 14:36:08 作者:佚名
我要評(píng)論
這篇文章主要介紹了使用netbeans搭建jsf+spring框架的方法,需要的朋友可以參考下
使用netbeans 搭建 JSF+SPRING 框架
spring版本使用4,jsf版本2.2
jsf的配置文件faces-config.xml
復(fù)制代碼
代碼如下:<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.0"
xmlns="<a
xmlns:xsi="<a
xsi:schemaLocation="<a >http://java.sun.com/xml/ns/javaee</a> <a >
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
</faces-config>
spring配置文件spring-config.xml
復(fù)制代碼
代碼如下:<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="<a
xmlns:xsi="<a
xmlns:aop="<a
xmlns:c="<a
xmlns:context="<a
xmlns:flow="<a
xmlns:jee="<a
xmlns:jms="<a
xmlns:lang="<a
xmlns:osgi="<a
xmlns:p="<a
xmlns:tx="<a
xmlns:util="<a
xmlns:jpa="<a
xsi:schemaLocation="<a >http://www.springframework.org/schema/beans</a> <a >http://www.springframework.org/schema/beans/spring-beans-4.0.xsd</a>
<a >http://www.springframework.org/schema/aop</a> <a >http://www.springframework.org/schema/aop/spring-aop-4.0.xsd</a>
<a >http://www.springframework.org/schema/context</a> <a >http://www.springframework.org/schema/context/spring-context-4.0.xsd</a>
<a >http://www.springframework.org/schema/webflow-config</a> <a >http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd</a>
<a >http://www.springframework.org/schema/jee</a> <a >http://www.springframework.org/schema/jee/spring-jee-4.0.xsd</a>
<a >http://www.springframework.org/schema/jms</a> <a >http://www.springframework.org/schema/jms/spring-jms-4.0.xsd</a>
<a >http://www.springframework.org/schema/lang</a> <a >http://www.springframework.org/schema/lang/spring-lang-4.0.xsd</a>
<a >http://www.springframework.org/schema/osgi</a> <a >http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd</a>
<a >http://www.springframework.org/schema/tx</a> <a >http://www.springframework.org/schema/tx/spring-tx-4.0.xsd</a>
<a >http://www.springframework.org/schema/util</a> <a >http://www.springframework.org/schema/util/spring-util-4.0.xsd</a>
<a >http://www.springframework.org/schema/data/jpa</a> <a >http://www.springframework.org/schema/data/jpa/spring-jpa.xsd</a>
">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
lazy-init="false">
<property name="locations">
<list>
<value>classpath*:jdbc.properties</value>
</list>
</property>
</bean>
<context:annotation-config/>
<context:component-scan base-package="cn.catr.lm.idc" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<!--不使用persistence.xml 做如下配置-->
<property name="packagesToScan" value="cn.catr.lm.idc.po"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.connection.driver_class">${jdbc.driverClassName}</prop>
<prop key="hibernate.connection.url">${jdbc.url}</prop>
<prop key="hibernate.connection.username">${jdbc.username}</prop>
<prop key="hibernate.connection.password">${jdbc.password}</prop>
<prop key="hibernate.c3p0.min_size">10</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean>
<!-- 配置事務(wù)管理器 -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- 啟用 annotation事務(wù)-->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
jdbc.properties文件
復(fù)制代碼
代碼如下:jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/idc
jdbc.username=root
jdbc.password=111111
相關(guān)文章

網(wǎng)絡(luò)工程師必備的6款配置文件編輯神器:替代Notepad++!
本期文章介紹了六種網(wǎng)工必備工具,這些工具是網(wǎng)絡(luò)工程師日常工作中必不可少的,也是那些立志成為網(wǎng)絡(luò)工程師的人應(yīng)該熟悉的2026-04-13
首個(gè)版本v1.111已上線! VS Code開(kāi)啟周更狂飆模式
026年3月10日,微軟宣布將Visual Studio Code(VS Code)更新節(jié)奏從月更提速至周更,并發(fā)布首個(gè)周更版本v1.1112026-03-11
AI直接調(diào)試瀏覽器! VS Code重大更新發(fā)布
還在手動(dòng)打開(kāi)瀏覽器、點(diǎn)擊按鈕、檢查控制臺(tái)報(bào)錯(cuò)?太累了!現(xiàn)在,最新的VS Code 1.110中AI可以直接調(diào)試瀏覽器2026-03-10
vc 6.0代碼是正確編譯無(wú)法運(yùn)行怎么解決?
今天帶大家來(lái)共同學(xué)習(xí)VC++6.0無(wú)法正常運(yùn)行怎么辦?下面就是詳細(xì)完整的操作步驟,快跟小編一起來(lái)學(xué)習(xí)一下2026-02-27
vscode調(diào)試c代碼始終找不到exe可執(zhí)行文件的詳細(xì)及解決辦法
在 VS Code 中調(diào)試 C++ 項(xiàng)目時(shí),常見(jiàn)報(bào)錯(cuò):“無(wú)法啟動(dòng)調(diào)試會(huì)話:找不到可執(zhí)行文件”,這個(gè)問(wèn)題問(wèn)題通常是由于環(huán)境配置不當(dāng)、缺少編譯步驟、路徑設(shè)置錯(cuò)誤、或是launch.json2026-02-27
vscode入門! 小白都能看懂的VS Code保姆級(jí)級(jí)使用教程
相對(duì)于其它前端工具來(lái)說(shuō),VSCode顯得更加的流暢,今天就將我的學(xué)習(xí)經(jīng)歷和大家分享一下,希望可以幫助到有需要的人2026-02-27
2026年真正值得裝、用得上、不雞肋的 VSCode 插件,其實(shí)沒(méi)那么多——挑10個(gè)“神級(jí)”不難,但得是每天打開(kāi)就用、關(guān)掉就難受的那種2026-02-10
VS Code 和 VSCodium怎么選? vscode 和 vscodium之間的區(qū)別
咱們今天就來(lái)聊聊 Visual Studio Code (VS Code) 和 VSCodium的相似與區(qū)別,詳細(xì)請(qǐng)看下文介紹2026-01-10
如何啟用.NET Framework3.5? 一鍵安裝net3.5解決軟件依賴問(wèn)題
你是否曾在安裝某些軟件時(shí)遇到過(guò)“需要.NET Framework 3.5”的提示?實(shí),只需要幾步簡(jiǎn)單的操作,你就可以輕松解決這個(gè)問(wèn)題2025-10-28
VS Code中Java擴(kuò)展代碼重構(gòu)功能的使用詳解
在軟件開(kāi)發(fā)過(guò)程中,重構(gòu)是一個(gè)非常重要的環(huán)節(jié),重構(gòu)可以提高代碼的可讀性、可維護(hù)性和可擴(kuò)展性,使代碼更加健壯和易于理解,本文將介紹如何使用 VSCode 進(jìn)行 Java 代碼重構(gòu)2025-09-20





