Hibernate+Spring+Struts2+ExtJS开发CRUD功能

Hibernate+Spring+Struts2+ExtJS开发CRUD功能

1、 入门:

各种开源框架环境及下载:

Hibernate3.x http://www.hibernate.org/ 需要hibernate core annotations 包。

Spring2.x http://springframework.org/

Struts22.x http://struts.apache.org/2.x/

ExtJS2.X http://extjs.com/

JSONJSON可以到http://www.json.org/ 查看详细内容,这里使用json-lib http://json-lib.sourceforge.net/

本所需要的包:

<shapetype coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f" id="_x0000_t75"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape type="#_x0000_t75" style="visibility: visible; width: 312pt; height: 286.5pt;" id="_x0000_i1031"><imagedata src="file:///C:%5CDOCUME%7E1%5Cmyloon%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_image001.png" o:title="" croptop="7605f" cropbottom="26218f" cropleft="21473f" cropright="22391f"></imagedata></shape>

2、 配置:

1)首先是配置web.xml,配置方法可以在下面的配置文件代码注释中查看,这里主要是Struts2的配置:

<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>

Spring的配置:

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/spring/*.xml</param-value>

</context-param>

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

Web.xml的全部文件:

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>struts2</display-name>

<!-- Spring ApplicationContext配置文件的路径,可使用通配符*,多个路径用,号分隔,此参数用于后面的Spring-Context loader -->

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/spring/*.xml</param-value>

</context-param>

<!-- 著名 Character Encoding filter -->

<filter>

<filter-name>encodingFilter</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>

<!-- struts2 滤镜配置 -->

<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>

<!--Spring ApplicationContext 载入 ,必须-->

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

<!-- Spring 刷新Introspector防止内存泄露 -->

<listener>

<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>

</listener>

<!-- session超时定义,单位为分钟 -->

<session-config>

<session-timeout>10</session-timeout>

</session-config>

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>index.jsp</welcome-file>

<welcome-file>default.html</welcome-file>

<welcome-file>default.htm</welcome-file>

<welcome-file>default.jsp</welcome-file>

</welcome-file-list>

</web-app>

2Hibernate配置:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!—-数据库驱动类名称 -->

<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

<!—-数据库用户名 -->

<property name="hibernate.connection.username">MY</property>

<property name="hibernate.default_schema">MY</property

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值