使用netbeans搭建jsf+spring框架的方法
發(fā)布時間:2014-04-23 14:36:08 作者:佚名
我要評論

這篇文章主要介紹了使用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)文章
WebStorm如何調(diào)試Vue項目? webstorm配置vue開發(fā)環(huán)境指南
WebStorm 支持多種調(diào)試工具,包括瀏覽器的開發(fā)者工具,但本文主要講解的是使用 WebStorm 自帶的調(diào)試功能2025-04-15VSCode和webstorm怎么設(shè)置綠色護(hù)眼背景? 綠豆沙背景色的設(shè)置方法
護(hù)眼色一定程度能保護(hù)眼睛,緩解疲勞,VSCode和webstorm這兩款常用的軟件怎么設(shè)置護(hù)眼色呢?詳細(xì)請看下文介紹2025-04-15- WebStorm本身已經(jīng)足夠強大,但一些優(yōu)秀的插件能錦上添花,顯著提升開發(fā)效率,詳細(xì)請看下文介紹2025-04-15
如何安裝配置WebStorm? WebStorm安裝與使用全方位指南
WebStorm軟件在前端和后端開發(fā)領(lǐng)域都備受青睞,很多朋友不知道該怎么下載安裝,下面我們就來看看詳細(xì)的安裝配置教程2025-04-15Webstorm怎么配置? Webstorm入門之軟件配置教程
WebStorm是一款功能強大的集成開發(fā)環(huán)境(IDE),支持各種前端開發(fā)技術(shù),今天我們就來看看Webstorm的配置教程2025-04-15Webstorm怎么設(shè)置字體大小/背景顏色/背景圖片?
WebStorm 允許您自定義界面顏色,以創(chuàng)建更個性化和美觀的工作空間,今天我們就來看看Webstorm改變字體大小、背景顏色、設(shè)置背景圖片的方法2025-04-15- VScode上安裝PlatformIO插件能成功安裝,嘗試卸載VScode并刪除插件,這些錯誤仍然存在,下面我們就來看看這個問題的解決辦法2025-04-03
提升代碼搜索效率! VSCode里DeepSeek插件安裝與配置指南
今天我們將向大家介紹如何在Visual Studio Code中安裝并配置 DeepSeek 插件,幫助你更高效地進(jìn)行代碼搜索2025-04-07提升你的編程效率! VSCode的初級使用教程超詳細(xì)版
VSCode是一款免費且開源的代碼編輯器,因其強大的功能和良好的用戶體驗而廣受歡迎,本文將詳細(xì)介紹 VSCode 的基本使用方法,并通過插圖幫助你更好地理解2025-04-03- 今天我們來聊聊如何安裝和配置VS Code,讓它成為你編程路上的得力助手,這個過程其實很簡單,只要跟著我的步驟走,你絕對能搞定2025-04-03