- 浏览: 293637 次
- 性别:
- 来自: 东京
文章分类
最新评论
-
80后的童年2:
企业级分布式搜索平台Solr视频教程网盘地址:https:// ...
企业级搜索引擎Solr使用入门指南 -
springdata_spring:
apache lucene开源框架demo使用实例教程源代码下 ...
Lucene / Solr 开发经验 -
springdata-jpa:
java web开发分页demo源代码下载:http://ww ...
简易java分页标签 -
zjf_sdnu:
兄弟,script写错了
jqGrid初学备注 -
85600367:
你好,请教一个问题。当进行分布式查询时solr无法查询到Luc ...
Lucene / Solr 开发经验
1. web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- 用于初始化Spring容器的Listener --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 载入spring配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/*.xml</param-value> </context-param> <!-- struts2本质上是一个filter --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name> struts-cleanup </filter-name> <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class> </filter> <filter-mapping> <filter-name>struts-cleanup</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 在freemarker中使用struts2标签 --> <servlet> <servlet-name>JspSupportServlet</servlet-name> <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
2. struts.xml
<struts> <constant name="struts.custom.i18n.resources" value="messageResource" /> <constant name="struts.i18n.encoding" value="UTF-8" /> <constant name="struts.ui.theme" value="simple" /> <constant name="struts.multipart.maxSize" value="1000000000" /> <include file="struts/demo-default.xml" /> </struts>
3. demo-default.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="demo-default" extends="struts-default" namespace="/"> <!-- 使用freemarker只为页面模板 --> <result-types> <result-type name="freemarke" default="true" class="org.apache.struts2.views.freemarker.FreemarkerResult" /> </result-types> <!-- 自定义权限拦截器 --> <interceptors> <interceptor name="authority" class="org.demo.common.AuthorityInterceptor" /> <interceptor-stack name="demoDefaultStack"> <interceptor-ref name="authority" /> <interceptor-ref name="defaultStack" /> </interceptor-stack> </interceptors> <default-interceptor-ref name="demoDefaultStack" /> <global-results> <result name="executeResult">/common/execute_result.ftl</result> <result name="exception">/common/exception.ftl</result> </global-results> <global-exception-mappings> <exception-mapping result="exception" exception="org.cms.common.ExceptionHandle" /> </global-exception-mappings> </package> <include file="struts/demo-home.xml" /> </struts>
4. demo-home.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="demo-home" extends="demo-default" namespace="/home"> <action name="index" class="org.demo.action.home.UserAction" method="index"> <result name="index">homepage.ftl</result> </action> </package> </struts>
5. applicationContext.xml - Spring
<?xml version="1.0" encoding="GBK"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- 定义数据源bean,使用Apache DBCP数据源实现 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/demo?characterEncoding=utf-8" /> <property name="username" value="root" /> <property name="password" value="123456" /> <!-- 可以同时闲职在连接池中的连接的最大数目 --> <property name="maxIdle" value="10" /> <!-- 最大激活连接数 --> <property name="maxActive" value="100" /> <!-- 请求连接最常等待时间 --> <property name="maxWait" value="30" /> <!-- 是否回收被遗弃的数据库连接到连接池中 --> <property name="removeAbandoned" value="true" /> </bean> <!--定义了Hibernate的SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- 为SessionFactory注入DataSource实例 --> <property name="dataSource" ref="dataSource" /> <!-- 指定Hibernate的实体映射文件 --> <property name="mappingResources"> <list> <value>classpath:org/demo/domain/</value> </list> </property> <!-- 指定Hibernate连接的系列属性 --> <property name="hibernateProperties"> <props> <!-- 指定Hibernate连接数据库的连接方言 --> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <!-- 是否显示Hibernate产生的SQL语句 --> <prop key="show_sql">true</prop> <!-- 启动应用时,是否根据hbm文件创建数据表 --> <prop key="hibernate.hbm2ddl.auto">update</prop> <!-- 指定Hibernate持久化操作的批操作大小 --> <prop key="hibernate.jdbc.batch_size">20</prop> </props> </property> </bean> <!-- 配置事务管理器,使用Hibernate局部事务管理器策略 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置事务拦截器 --> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <!-- 事务拦截器bean需要依赖注入一个事务管理器 --> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <!-- 下面定义事务传播属性 --> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- 定义BeanNameAutoProxyCreator --> <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <!-- 指定对满足哪些bean name的bean自动生成业务代理 --> <property name="beanNames"> <!-- 下面是所有需要自动创建事务代理的bean,此处可增加其他需要自动创建事务代理的bean --> <list> <value>demoService</value> </list> </property> <!-- 下面定义BeanNameAutoProxyCreator所需的事务拦截器 --> <property name="interceptorNames"> <list> <!-- 此处可增加其他新的Interceptor --> <value>transactionInterceptor</value> </list> </property> </bean> <!-- 定义MailSender Bean,用于发送邮件 --> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="smtp.163.com" /> <property name="javaMailProperties"> <props> <prop key="mail.smtp.auth">true</prop> <prop key="mail.smtp.timeout">25000</prop> </props> </property> <property name="username" value="username" /> <property name="password" value="password" /> </bean> <!-- 配置MailMessage Bean --> <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage"> <property name="from" value="username@163.com" /> <property name="subject" value="Demo" /> </bean> </beans
6. applicationContext-dao.xml
<?xml version="1.0" encoding="GBK"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="daoTemplate" abstract="true"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="demoDao" class="org.demo.dao.impl.DemoDaoImpl" parent="daoTemplate" /> <!-- Dao工厂类 --> <bean id="daoManager" class="org.demo.dao.DaoManager"> <property name="demoDao"> <ref bean="demoDao" /> </property> </bean> </beans>
7. applicationContext-service.xml
<?xml version="1.0" encoding="GBK"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="demoService" class="org.demo.service.impl.DemoServiceImpl" /> <bean id="serviceManager" class="org.demo.service.ServiceManager"> <property name="demoService"> <ref bean="demoService" /> </property> </bean> </beans>
8. freemarker.properties
default_encoding=UTF-8 number_format=# date_format=yyyy-MM-dd time_format=HH:mm:ss datetime_format=yyyy-MM-dd HH:mm:ss auto_import=/common/page_macro.ftl as p
9. log4j.properties
log4j.rootLogger=INFO, CONSOLE, FILE log4j.addivity.org.apache=true log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.Threshold=DEBUG log4j.appender.CONSOLE.Target=System.out log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern= %c %x - %m%n log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender log4j.appender.FILE.File=webapps/demo/WEB-INF/logs/file.log log4j.appender.FILE.DatePattern=.yyyy-MM-dd log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=[DEMO] %d - %c -%-4r [%t] %-5p %c %x - %m%n
发表评论
-
Struts2 Jsonplugin 详解
2009-07-08 21:41 7057本文转自: http://www.blogjava.net/f ... -
一点struts json备注
2009-07-05 00:30 1503下载struts json插件:jsonplugin-0.33 ... -
Hibernate annotation简单配置
2009-06-29 00:04 1611<?xml version="1.0" ... -
Liferay下整合Spring和Hibernate开发Plugin初试
2009-05-26 00:41 4842简单的说,完全不知道Liferay下应该如何做开发。所以完全凭 ... -
Liferay plugin开发入门
2009-05-19 00:10 2685本篇部分引用以下文章: http://daoger.itey ... -
Hibernate通用DAO
2009-01-02 17:46 3595/** * @author Clay Zhong, zjcl ... -
Acegi获取用户信息
2008-12-04 23:38 2809import org.acegisecurity.Authen ... -
Acegi详解
2008-11-16 21:15 1733本文转自:http://www.yuanma.org/data ... -
velocity.properties source code
2008-11-04 22:37 2965# Licensed to the Apache Softwa ... -
DetachedCriteria,Hibernate模糊查询
2008-09-21 10:59 41601,假设存在Thesis对象: package org.cms ... -
lucene常用搜索排序摘录
2008-09-16 23:38 3103一,查询 一个关键字,对一个字段进行查询 Query ... -
Solr中SimplePostTool的修改
2008-09-15 22:38 2919将源代码修改为传递字符串,去掉files以及stdin模式。 ... -
企业级搜索引擎Solr使用入门指南
2008-09-10 22:43 16621本文转自 http://chuanliang2 ... -
Lucene / Solr 开发经验
2008-09-10 22:12 19969转自 Lucene/Solr开发经验[原] 作者 张驰有道 ... -
Lucene初学备注
2008-09-07 19:51 12261,检索文件目录,创建index import java.io ... -
JR各Ajax框架基础教程收集
2008-08-24 12:19 1160JQuery: http://www.javaresearch ... -
Spring 2.0 中配置 JPA
2008-04-20 16:57 3841翻译:SpringSide团队 转载请注明出处。 本文提供了 ... -
Hibernate延迟加载
2008-02-09 16:22 2703延迟初始化错误是运用Hibernate开发项目时最常见的错误。 ... -
Properties资源文件编码
2008-01-26 17:26 14781、展开Eclipse的Help菜单,将鼠标移到Softwar ... -
struts+hibernate分页
2007-12-17 20:53 1689新建表 sql 代码 DROP DATABAS ...
相关推荐
struts2 spring2 hibernate3整合源代码+jar包struts2 spring2 hibernate3整合源代码+jar包
整合使用最新版本的三大框架(即Struts2、Spring4和Hibernate4),搭建项目架构原型。 项目架构原型:Struts2.3.16 + Spring4.1.1 + Hibernate4.3.6。 此外,还有:log4j、slf4j、junit4、ehcache等知识点。 项目...
Struts2 Spring2 Hibernate3 整合实例; 数据库MySql 5; IDE: NetBeans6.9 也可导入到MyEclipse中。 保证能够实现。 请先看内部的说明文件。
轻量级JavaEE企业应用实战_Struts2+Spring3+Hibernate整合开发_第3版.part1
Struts1+Spring2+Hibernate2整合详细例子
Struts 2+Spring 3+Hibernate框架技术精讲与整合案例2Struts 2+Spring 3+Hibernate框架技术精讲与整合案例2Struts 2+Spring 3+Hibernate框架技术精讲与整合案例2Struts 2+Spring 3+Hibernate框架技术精讲与整合案例2
使用mysql数据库的struts2 spring hibernate整合简单示例,也可参考我的:“struts2 spring hibernate整合要点、注意点”这篇文档来配置
[轻量级Java_EE企业应用实战_Struts2_Spring3_Hibernate整合开发
Struts2 Spring3 Hibernate3.3框架整合,增删改查,包含有数据库建表语句,包含有JAR包,包含有源代码。包含有事务的配置以及运用。使用的是Oracle的序列来提供的主键自增,建表和建立序列的sql语句,已经放在工程...
轻量级JavaEE企业应用实战_Struts2+Spring3+Hibernate整合开发_第3版.part2
struts2+spring+hibernate整合小案例,是一个很好的学习小DEMO
struts2+spring+hibernate整合实例.rar struts2+spring+hibernate整合实例.rar
struts2 spring hibernate 整合
轻量级JavaEE企业应用实战_Struts2+Spring3+Hibernate整合开发_第3版.part5
Struts2 Spring3 Hibernate4 框架完美整合
Struts2,Spring与Hibernate整合应用,学生成绩管理系统
MyClipse6.0\Struts2,Spring与Hibernate整合应用,学生成绩管理系统
SSH整合示例(详情见我博客专栏)之前的博客我们总结了spring基础、spring分别整合struts2、hibernate、mybatis等,今天我们来同时整合下 struts、spring、hibernate,也就是所谓的 ssh 。 整合流程: 1 首先整合...
struts2整合spring、hibernate的jar包
共分四个压缩包,JavaEE企业应用实战-Struts2+Spring3+Hibernate整合开发(第3版).part3