TA的每日心情 | 衰 2021-2-2 11:21 |
---|
签到天数: 36 天 [LV.5]常住居民I
|
1.简介 后端基于spring, struts1和hibernate,前台用bootstrap实现。
9 H) c/ T* j, u& q 实现的功能也比较少,基本的crud操作,文件上传,ajax异步刷新等。$ R; _$ {& k8 Y$ }! Z
2.代码结构
5 u8 ?) X3 ?6 j7 d( r, P+ y; R
: {! Q9 f) Q! A/ l5 l
3: applicationContext.xml配置文件- S+ ~0 r# G9 ]) i) u, E4 ~/ v
- <?xml version="1.0" encoding="utf-8"?>! K) S( I0 p; z
- <beans xmlns="http://www.springframework.org/schema/beans"
7 F5 J$ {+ ]* K; F - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- @& E- V; g# g' X4 v5 ~2 V - xmlns:context="http://www.springframework.org/schema/context"
! w# }, N: X# p/ }: v! { - xmlns:tx="http://www.springframework.org/schema/tx"9 m: I2 h/ T$ G# S- y* R" T
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd, k0 o% Z% t5 u: g- ?8 _+ w$ Y( e
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd7 O8 L! N2 X! N2 ]0 O3 X: U4 ^# @6 L/ h1 W
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">0 U, ^3 V1 u- e/ ^$ R
- <!-- 启用注解扫描 -->
2 k& Z2 E" h' o( q/ w - <context:annotation-config/>. C8 i; e$ [6 h" r! E- _
- . |1 v5 c2 Q2 r* V; H ^
- <!-- 配置数据源 -->
6 ]) z' _' o3 u- `( k, G9 p - <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
S4 N9 C" \3 U: `( K7 r* E - <property name="driverClassName" value="com.mysql.jdbc.Driver" />* z$ O; Q9 A: F6 I( e
- <property name="url" value="jdbc:mysql://localhost:3306/wireless"/>
0 o1 u' m6 Y0 |+ m! g( { - <property name="username" value="root"/>9 ]$ B' L J# }8 K
- <property name="password" value="110511"/>3 G4 L( O( c! |: F1 w
- </bean>
* D0 l9 t5 O0 Y0 D8 b - <!-- 配置会话工厂 -->) S9 ^" h! v. i2 M) p1 C* q1 y
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">) c) C. }7 A! ~. e( r4 g
- <!-- 设置数据源 -->2 t$ F3 \( B0 Q- T
- <property name="dataSource" ref="dataSource" />0 e) L5 q6 t3 i$ `: l$ }, _8 f8 h/ O: i3 w& u
- <!-- 配置映射文件 -->) G9 p; V1 z% v& g+ m
- <property name="mappingResources">- ?3 V1 Z" m; j K3 ?% j& ?
- <list>
0 |% J. U c5 @ - <value>com/wireless/entity/hbm/Usertbl.hbm.xml</value>; M- R/ h2 U5 G: o1 Y& i+ v
- <value>com/wireless/entity/hbm/Menutypetbl.hbm.xml</value>; ?1 |. Z) G$ u& z0 l
- <value>com/wireless/entity/hbm/Tabletbl.hbm.xml</value>
8 F* w7 ?7 K7 h$ |3 Y3 F) l - <value>com/wireless/entity/hbm/Menutbl.hbm.xml</value>
" X0 S( L; ^& p0 k5 a - <value>com/wireless/entity/hbm/Ordertbl.hbm.xml</value>
* ^; r$ Y8 @* ~6 X: l4 U% a - <value>com/wireless/entity/hbm/Orderdetailtbl.hbm.xml</value>
! v6 G7 \5 `) O# p: n' B. E - </list>. S4 ~4 n2 q! z: c0 @
- </property>( d" y4 P2 Z9 I. n
- <property name="hibernateProperties">: E' i8 d/ [9 B2 N2 k0 B% r
- <props>
. q' U. q' b7 t! G - <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
; Z4 @; j# d0 s- } Y+ P - <prop key="hibernate.hbm2ddl.auto">update</prop>
. H: G8 H' f* k. Q( ~+ U - <prop key="hibernate.show_sql">true</prop>
% G2 H! n( Z$ N( v# z$ A. w3 }2 { - <prop key="hibernate.cache.use_second_level_cache">true</prop>: d) U* F Q6 {! B0 e4 |; H
- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
1 F5 ?/ `% [: {' |' G2 _/ T$ s - <prop key=" hibernate.generate_statistics">true</prop>( v) {! n! P. p( H; z& f
- / t' |6 n# S2 ~7 T' P
- </props>
2 j v( J* c; |& k8 } - </property>
' v1 l2 z; U" V: {# Z - </bean>
7 Y! r7 ?* M& y5 _7 k: x8 F" ^ - , d5 K2 z: x+ a! L, @! A: ?
- <!-- 配置Service -->
% D! L; k. W) o# M8 j
' b5 ~' W4 T- _' f9 B: `2 m3 C- <!-- 配置Service -->
% L( ?! s7 U1 v8 K - <bean id="userService" class="com.wireless.web.service.impl.UserServiceImpl" />
) H/ a; g4 w. n: T1 l - <bean id="tableService" class="com.wireless.web.service.impl.TableServiceImpl" />
# d+ {* t1 Y5 J, z8 Q - <bean id="menuService" class="com.wireless.web.service.impl.MenuServiceImpl" />
8 W" K! R3 @8 }1 B! A! ]) d - <bean id="orderService" class="com.wireless.web.service.impl.OrderServiceImpl" />
: f* J1 s* y+ B* b5 o/ M- W - ( r" `2 y% m Y6 y0 U4 y
- <!-- 配置action ,prototype为原型,每次生成新的action 解决并发问题-->
# Q3 r9 H) a4 t* p - <bean name="/login" class="com.wireless.web.action.LoginAction" >
: l- N5 Q( Y6 o1 M: x& P* h - <property name="userService" ref="userService"></property>
! Z G2 i' d0 R0 u; B. K - </bean>: `' w1 y2 m4 t$ ^
- <bean name="/home" class="com.wireless.web.action.HomeAction" >. u) ?. l2 C# h3 P
- <property name="userService" ref="userService"></property>& F$ B& g+ _+ `5 o( Q% D
- </bean>/ Y3 D' j( u/ Q+ V" [
- <bean name="/table" class="com.wireless.web.action.TableAction" >0 y7 E h% m! h5 Z4 I2 M. J" \
- <property name="tableService" ref="tableService"></property>
8 W9 s% i( l3 I) i - </bean>/ y8 h, e. @. U, D, l
- <bean name="/menu" class="com.wireless.web.action.MenuAction" >
. A9 i& e! ^4 a% P/ H. {4 [7 o - <property name="menuService" ref="menuService"></property>
+ Q( e# J# D3 s B: M - </bean>
. Y6 _+ l. T( c5 a; q - <bean name="/order" class="com.wireless.web.action.OrderAction" >* x4 g: B# ^) G: }
- <property name="orderService" ref="orderService"></property>
6 w) o/ c) F, W) ]* J q W - </bean>$ ^$ A! i2 i; I6 |7 D7 }' |9 D
- " ~: ], D4 H: S) l4 l$ g+ Q& Z1 b
- <!-- 配置事务管理器,统一管理sessionFactory的事务 -->1 h# |0 x! E+ f$ M* E9 g. }
- <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">+ ?. A w% } V" P
- <property name="sessionFactory" ref="sessionFactory"/>
! g0 k- k' C9 m b - </bean>. l0 I: \; u A
- <!-- 启用事务注解 -->
$ b' x3 [1 l; q; l0 l - <tx:annotation-driven transaction-manager="txManager"/>
2 t4 d9 y: f5 @, S% t
# Z; h9 N- E d7 V Y4 K( s( K- </beans>- i+ \/ n( K* Z$ _4 }6 m6 v5 l
复制代码 4:hibernate.cfg.xml配置文件6 O% [" G4 p# B8 S" v
- <?xml version='1.0' encoding='UTF-8'?>9 k9 @. I$ ]4 G7 W, a
- <!DOCTYPE hibernate-configuration PUBLIC
5 F# {5 X4 S5 F - "-//Hibernate/Hibernate Configuration DTD 3.0//EN"! l# \% a$ ~4 j- M& \
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
! h4 S" s0 E9 s2 n2 U+ u - . C; }7 ]0 H0 z: K
- <!-- Generated by MyEclipse Hibernate Tools. -->
7 `, ~. ~* ~7 e) T1 T0 q - <hibernate-configuration>
# ^3 o# `8 M( o! S% q" X7 d2 ~
1 e3 G6 f- a$ N1 n- <session-factory>* x$ v; {0 I- _, D! z, F
- <property name="dialect">
9 l; Z0 d& d; e1 @0 N2 t- B - org.hibernate.dialect.MySQLDialect
% F, j1 a8 ]+ B9 H9 ~0 A - </property>
" O4 E! e: ?4 q% C1 W! J - <property name="connection.url">
% Z) h9 W7 K" v7 N3 C - jdbc:mysql://localhost:3306/struts
2 O3 F$ w. K O. ?$ j# a- X - </property>
7 _( J2 f" c- Z; ~: S - <property name="connection.username">root</property>! u$ e: _5 v+ `! K8 x$ ?
- <property name="connection.password">110511</property>
# Q- o8 s+ k! i" o! r+ w/ Z - <property name="connection.driver_class">
( T, c5 E$ I0 p; Z5 x& }* B- P- | - com.mysql.jdbc.Driver
) p. b5 A* R, y3 y% o - </property>
4 b$ V0 T8 D) q# A$ C - <property name="myeclipse.connection.profile">mysql</property>
+ i1 j% I/ w3 p% t, }; M - <mapping resource="com/wireless/entity/hbm/Usertbl.hbm.xml" />: T% y; M5 K$ L4 b
- <mapping resource="com/wireless/entity/hbm/Menutypetbl.hbm.xml" />
3 ~0 E9 C' R' H$ c0 C) } - <mapping resource="com/wireless/entity/hbm/Tabletbl.hbm.xml" />
& G" i, S1 I) _! a& ]- g( f) v) E# U - <mapping resource="com/wireless/entity/hbm/Menutbl.hbm.xml" />% i2 F- {* _) X; v* d/ ^6 l
- <mapping resource="com/wireless/entity/hbm/Ordertbl.hbm.xml" />/ y& b: D+ u6 U6 v5 E
- <mapping resource="com/wireless/entity/hbm/Orderdetailtbl.hbm.xml" />: s4 A: u7 d8 @0 g7 V# a2 N
- 9 f6 ?5 F5 d! J0 J: j: }' Y) `
- </session-factory>7 k X0 O0 _8 x* n2 R, x
) G) }+ [- K- o* {% ~' h ^- </hibernate-configuration>
复制代码 5:界面展示* {( [5 R) P% N4 g
! ~3 b B0 P8 J/ I5 p' D s
( d9 ` {% N& {9 q6 i1 n; ?
2 _. o( \6 L, e7 @% u- p2 K7 J& R6 k; R/ ?# O
$ s' o5 d/ Y' d' ]& G" Q4 Q$ d8 Q6 W, \; j% t7 [. {
: `5 A2 C. \( R- S" @
9 G" h* j+ f7 p1 V' ~3 R! J) ]
6 \# E' b6 _. k7 G( N1 F8 f) E3 Q4 |( ~
' _2 L5 V9 Q! i$ R6 N' V6 d% t1 A5 M- }* a( y
6 I# s% H* b; m+ [
项目源码下载地址:javaWeb三大框架SSH + BootStrap网上订餐系统 3 ?6 l- t+ O, U. W* x0 b
解压密码:
& [$ c% [; Z5 z- Z
) T5 x. D1 n4 d) w |
-
总评分: 帮币 + 5
查看全部评分
|