TA的每日心情 | 衰 2021-2-2 11:21 |
---|
签到天数: 36 天 [LV.5]常住居民I
|
1.简介 后端基于spring, struts1和hibernate,前台用bootstrap实现。
9 D3 x% _4 ~+ e [$ b4 [ 实现的功能也比较少,基本的crud操作,文件上传,ajax异步刷新等。2 H5 M1 B4 |( A5 G1 e
2.代码结构
7 A D/ Z+ H7 K& p! f! A0 w) V5 X6 J/ A5 j
3: applicationContext.xml配置文件
, ^6 O3 }8 F6 L8 x5 V3 s- <?xml version="1.0" encoding="utf-8"?>
$ L- y( f5 O# @ - <beans xmlns="http://www.springframework.org/schema/beans"
0 z' r, p9 F# m* Z a/ f; Y - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"6 Z a3 m% i1 n
- xmlns:context="http://www.springframework.org/schema/context"
2 m, w# t+ ?3 Y* U0 e- g - xmlns:tx="http://www.springframework.org/schema/tx"9 _4 x) r6 A) B8 {
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
' {$ O8 o$ C9 v - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd M7 _) ` @ r. i) |# T
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
% r! J9 m; p( i2 O: L1 m0 u - <!-- 启用注解扫描 -->4 o: A/ {* w5 W4 \ x
- <context:annotation-config/>
6 D$ w4 H! q2 a" h$ f
8 [# k2 C b+ [* e7 w6 P& t' \- <!-- 配置数据源 -->- [, G* @. B; `3 _9 l' `% O
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">' |3 J- h# y0 [7 H! t, @
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
4 k. f1 |3 x: Q1 |' P - <property name="url" value="jdbc:mysql://localhost:3306/wireless"/>
/ |) L* J2 r( W5 p" q, a - <property name="username" value="root"/>
; Z. h% h- `: J; J' y% l1 v8 A - <property name="password" value="110511"/>& H& d5 m( n3 W
- </bean>
9 u# X7 W6 k H. M. ? - <!-- 配置会话工厂 -->
7 z: B2 E+ [1 E - <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
( y/ Q! m+ U! N, R: I - <!-- 设置数据源 -->
1 _3 o+ H& d: f" Q- A" a' Q - <property name="dataSource" ref="dataSource" />
- _& d K, E7 ^4 k: z" v; _ - <!-- 配置映射文件 -->; C L, P7 f, h4 G- d8 [9 E
- <property name="mappingResources">
+ \3 W; ^$ C# J- J( R2 l - <list>
5 m" D& D, P3 F) V - <value>com/wireless/entity/hbm/Usertbl.hbm.xml</value>9 L6 u3 W# S9 U4 K' D& B6 c
- <value>com/wireless/entity/hbm/Menutypetbl.hbm.xml</value>
5 p5 ?8 p7 F& l+ ? - <value>com/wireless/entity/hbm/Tabletbl.hbm.xml</value>+ ~! ?: B0 k) s! S$ J
- <value>com/wireless/entity/hbm/Menutbl.hbm.xml</value> u! v$ K0 ?# W1 t
- <value>com/wireless/entity/hbm/Ordertbl.hbm.xml</value>
9 F) L- N+ d! h - <value>com/wireless/entity/hbm/Orderdetailtbl.hbm.xml</value>
8 E3 C9 m/ f. _9 F8 z4 m - </list>
: Z3 j' b: G. O: S# ~; \9 n% V1 x - </property>1 V9 _5 E% [% k. t, G0 z
- <property name="hibernateProperties">
/ q) w t$ ]# h9 e - <props>7 D$ e: J: t8 h ]/ T3 Q
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
W6 j8 a6 i$ q/ r! W1 r4 a& ^6 U - <prop key="hibernate.hbm2ddl.auto">update</prop>
7 R' [% A* h3 N) o# v7 ~2 K M - <prop key="hibernate.show_sql">true</prop>
: H9 m- ~7 U/ {1 j: | - <prop key="hibernate.cache.use_second_level_cache">true</prop>
C! a/ C% n' s1 K - <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>. `' W4 u/ i/ ~6 ^: y2 Y2 U! f
- <prop key=" hibernate.generate_statistics">true</prop>
/ }8 \$ _, Y( G -
: f1 n. e4 X' O& Z2 a7 A - </props>
# j) n+ O$ b; K+ ? - </property>
3 |2 y3 }$ E! t; k" r: M - </bean>
, W& p0 s, `7 o# {0 h - 2 {. @9 p6 p$ t S4 O; n1 x
- <!-- 配置Service -->5 ^) T. G6 S( `2 s9 X
, o# j D" F G8 a+ _0 H1 o4 E- <!-- 配置Service --> D7 Q: D$ r/ ]! P, u
- <bean id="userService" class="com.wireless.web.service.impl.UserServiceImpl" />2 ?8 [9 E& n" p( q
- <bean id="tableService" class="com.wireless.web.service.impl.TableServiceImpl" />2 ^) }+ J" O) I/ t/ `1 N5 W/ j, f
- <bean id="menuService" class="com.wireless.web.service.impl.MenuServiceImpl" />
6 v* v2 o) E/ w% T1 Z# @' P - <bean id="orderService" class="com.wireless.web.service.impl.OrderServiceImpl" />
% ]0 f) ^# X" B) S
) [* _% X7 c5 i- }- G- <!-- 配置action ,prototype为原型,每次生成新的action 解决并发问题-->
- G2 N" V* W6 b% T% M8 a! ]! @ - <bean name="/login" class="com.wireless.web.action.LoginAction" >. f! n) z" Z( @; M, @, |
- <property name="userService" ref="userService"></property>% A1 D. l/ J* c( f/ f
- </bean>
1 p5 R: H4 z+ V" l! n - <bean name="/home" class="com.wireless.web.action.HomeAction" >
0 O U" \: L5 _) z: c0 X - <property name="userService" ref="userService"></property>8 d$ q4 k+ h. O+ L) H0 w( z7 n
- </bean>
. T b: X/ U! k - <bean name="/table" class="com.wireless.web.action.TableAction" >
: E2 g4 c+ V, z8 q - <property name="tableService" ref="tableService"></property>$ u: u% p4 U( S0 v
- </bean>
/ U" _* K4 }9 V) d( y - <bean name="/menu" class="com.wireless.web.action.MenuAction" >2 H# O0 ?' Z# b8 l. ^% Q0 K
- <property name="menuService" ref="menuService"></property>
9 G/ E S3 b4 ^2 D, ^8 b - </bean>6 U. O* R4 M6 c$ U/ R2 [
- <bean name="/order" class="com.wireless.web.action.OrderAction" >7 m* [3 T7 i W" V9 C7 h4 ]* c$ w
- <property name="orderService" ref="orderService"></property>8 V/ F4 O {9 m. ~; j
- </bean>
8 Y# x% o V$ ]9 n" N: X8 k0 c/ U - . Z$ X0 v K8 x& X/ W
- <!-- 配置事务管理器,统一管理sessionFactory的事务 -->
+ h- c3 {/ q6 x c, g0 C - <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
) J& R0 Z, O. q7 Q; q. x0 W - <property name="sessionFactory" ref="sessionFactory"/>
2 F9 E% r. b+ u2 w1 ] - </bean>. ]' h. Z1 b: g: v) O z3 _5 f g8 h
- <!-- 启用事务注解 -->6 H {3 }0 V# o( m$ ]0 \
- <tx:annotation-driven transaction-manager="txManager"/>
2 \& C. X; o2 {5 p4 v' z - 3 a& w) r9 M% J' q, D
- </beans>
2 B4 a7 p. O$ m( n7 U2 z5 i) n' e( o
复制代码 4:hibernate.cfg.xml配置文件
% X" Y/ b6 G% G i% ?- <?xml version='1.0' encoding='UTF-8'?>5 P ^2 i' N \1 t3 ?# ^
- <!DOCTYPE hibernate-configuration PUBLIC
' U: N5 U( V* m+ U y) X# S" X - "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
4 z) Q& Z; @/ _4 w8 [ - "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
0 `' f9 ]2 ^5 b. `4 r, W* L# U - 6 ^' D0 W+ }" }! \4 S
- <!-- Generated by MyEclipse Hibernate Tools. -->7 J* I0 _/ v$ D
- <hibernate-configuration>6 R8 Y% b' z; D3 J
# O4 ?; ^4 `1 P- v1 _- <session-factory>
" x9 f+ L# }2 ]; { - <property name="dialect">7 b9 R. m- Q0 {& p# m' m! M) c8 r
- org.hibernate.dialect.MySQLDialect
$ J- R# N; d/ Y+ I" M" ^% k - </property>
6 k- R2 O3 a# p9 O/ v. {) t - <property name="connection.url">- k# e8 f# ?9 |3 o3 t0 p/ r
- jdbc:mysql://localhost:3306/struts
' ~2 n7 k p5 m - </property>0 S2 `: h3 F. [! \9 N
- <property name="connection.username">root</property>+ [# r6 E- J# v
- <property name="connection.password">110511</property>; S6 Z; P( b+ X( E
- <property name="connection.driver_class">" q& A' R3 D: F, |6 P% p% a
- com.mysql.jdbc.Driver p8 A, z% _* k9 y' l# w
- </property>1 B" X% i+ ^+ I1 H I* R6 r6 q! }
- <property name="myeclipse.connection.profile">mysql</property>; _0 N9 O1 q6 Z# @! P6 Y* e9 E
- <mapping resource="com/wireless/entity/hbm/Usertbl.hbm.xml" />, d' [: a4 D+ {% Q# J2 s! s
- <mapping resource="com/wireless/entity/hbm/Menutypetbl.hbm.xml" />0 B7 S/ [/ z; Z5 W( Z5 \$ M& |4 I4 y
- <mapping resource="com/wireless/entity/hbm/Tabletbl.hbm.xml" />
; t; ?5 s% r0 I - <mapping resource="com/wireless/entity/hbm/Menutbl.hbm.xml" />
- j, T: I d2 T - <mapping resource="com/wireless/entity/hbm/Ordertbl.hbm.xml" />
; y" k y: o H9 r. s, b# p8 L r - <mapping resource="com/wireless/entity/hbm/Orderdetailtbl.hbm.xml" />1 [0 |+ H @! A* I. U& i1 Y+ l
3 I9 v1 b- V% R# O- S9 H2 { }- </session-factory>
8 y1 J! p% V& M - : N( o6 n7 H9 G% U) p( S3 V# J n1 t; `
- </hibernate-configuration>
复制代码 5:界面展示
% Z% ~6 ~8 I+ c/ B- x* B
$ \) U5 {8 P }, K4 |4 s7 z% G& i8 @4 N% G
/ b7 j+ N6 P* A$ |
# p* d' ~. V1 Q; B& r0 a' d/ P
- D5 B+ h" a& f( g; R3 R6 N2 q9 s
" J( G# u7 ]5 P/ e
: N& ?: f% Y/ h! w7 z$ w, m7 I$ e3 ~/ x4 U! q, h/ a
0 u* B, @- X+ \# \5 ?) u7 e. E
5 ^6 U* H L& ^" y- ^/ ~/ F
0 G# K, w* V! q6 S4 J, G
5 ^7 U9 i) M- o( e: m; \! u
7 l* H" _: U8 P2 {4 g; S项目源码下载地址:javaWeb三大框架SSH + BootStrap网上订餐系统 # z% }% U& w1 o1 u4 y
解压密码:4 O4 ]1 k( {+ r
0 W" [ j9 Z& A2 Q) [ |
-
总评分: 帮币 + 5
查看全部评分
|