TA的每日心情 | 衰 2021-2-2 11:21 |
---|
签到天数: 36 天 [LV.5]常住居民I
|
1.简介 后端基于spring, struts1和hibernate,前台用bootstrap实现。+ e$ r/ a7 b' w
实现的功能也比较少,基本的crud操作,文件上传,ajax异步刷新等。
" C5 x {& Q9 I/ J. f 2.代码结构
( J0 f5 o: v: G" C& J0 w& C4 W
; y3 W9 y- K+ K3 [) \# b
3: applicationContext.xml配置文件2 \2 x- v# M% a: m! J
- <?xml version="1.0" encoding="utf-8"?>1 N/ A# f ?( a1 h+ m8 `
- <beans xmlns="http://www.springframework.org/schema/beans"- d: U* G$ _3 z
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' M- O. A8 c" C5 r( J* E
- xmlns:context="http://www.springframework.org/schema/context"
, |& l7 Q# w& `' p - xmlns:tx="http://www.springframework.org/schema/tx"/ z0 a4 G2 ]7 } r( U8 Q. ~
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd8 N- g5 b- o8 l* S5 L# @
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
9 {$ U W$ ]& b1 ]- k7 T+ C) G$ b - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
5 A4 S @0 r! q - <!-- 启用注解扫描 -->
% Z3 {! G# J9 o: ] - <context:annotation-config/>9 N# f- K1 O$ l9 L
( p$ C2 G' \$ t- <!-- 配置数据源 -->5 k- R! Y0 A0 g( V
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">" y% h# @1 w. F& M+ g
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
a" Q! m& n% t# N% [( i - <property name="url" value="jdbc:mysql://localhost:3306/wireless"/>: T5 d+ w, f5 V5 q: u! z
- <property name="username" value="root"/>6 K& f$ R+ B! t0 _
- <property name="password" value="110511"/>' Z, C) W: H2 Y. g$ P
- </bean>
# l* I- x* i; ?9 d - <!-- 配置会话工厂 -->
# H) T6 Y! L# N8 S% G - <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">( _/ j5 ?- c9 E# {0 ?% ^8 V
- <!-- 设置数据源 -->$ i; [0 g1 x. o, n6 v5 F# h) v
- <property name="dataSource" ref="dataSource" />
% ^1 t9 l/ T; _3 @5 @, _ - <!-- 配置映射文件 -->
# ]) Y! R6 z$ g, [4 B8 Z* L - <property name="mappingResources">. I4 Y3 M1 P ^ Z& ]" v3 I
- <list>" N! }; V' Q/ E* _2 A$ e/ _
- <value>com/wireless/entity/hbm/Usertbl.hbm.xml</value>
- r6 m. X' g4 d* d" x1 _ - <value>com/wireless/entity/hbm/Menutypetbl.hbm.xml</value>
X. M: R6 F( x9 L4 S0 [ - <value>com/wireless/entity/hbm/Tabletbl.hbm.xml</value>% M, a. \$ V4 Z1 z* v
- <value>com/wireless/entity/hbm/Menutbl.hbm.xml</value>9 O6 J( S' g2 u( d
- <value>com/wireless/entity/hbm/Ordertbl.hbm.xml</value>' b) h: P( f! [) I
- <value>com/wireless/entity/hbm/Orderdetailtbl.hbm.xml</value>1 T, V/ N/ ~1 O/ W
- </list>
' X# a5 t c1 P3 V' L$ {/ X - </property>
6 u3 Q$ ^ ~3 b7 K; g7 x; K' J+ ` - <property name="hibernateProperties">3 G- h: W" y* L4 `* }
- <props>
6 u5 f: u3 W8 \- v; R* ] - <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>5 }2 e3 B( b$ y& R
- <prop key="hibernate.hbm2ddl.auto">update</prop>
: G& \( c9 r( B - <prop key="hibernate.show_sql">true</prop>
+ A: O3 i9 ]5 ?4 ]+ H - <prop key="hibernate.cache.use_second_level_cache">true</prop>
! s/ j* L1 y# B2 Z1 q0 S" |$ x - <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>3 s2 N) y* {. t! \
- <prop key=" hibernate.generate_statistics">true</prop>$ S& ^) ^7 \! f! P+ j' Z
-
# {6 X% d0 Q$ u0 T% [) ] - </props>
4 _' E5 u) T' w - </property>0 U) e" p2 @% r6 }5 k9 E
- </bean>$ v8 w6 W# Y2 D% z* ^% ~
$ v8 |3 _% z9 @; t- <!-- 配置Service --> `% D$ G! O `: s4 k
: W! Z9 D" u) D/ C3 ]) \: W I- <!-- 配置Service -->9 a; _# O8 k8 y1 S4 q+ ~+ N
- <bean id="userService" class="com.wireless.web.service.impl.UserServiceImpl" /> |2 c* d. ]8 b4 x) v# x1 x+ O6 ~
- <bean id="tableService" class="com.wireless.web.service.impl.TableServiceImpl" />
9 O7 T% Q( i* G/ ~/ t - <bean id="menuService" class="com.wireless.web.service.impl.MenuServiceImpl" />( V2 M; d) C2 F8 _1 o$ a
- <bean id="orderService" class="com.wireless.web.service.impl.OrderServiceImpl" />4 X+ y8 _& c2 q _# N7 W0 N
- * V- j" _, \$ Z1 D" f% f
- <!-- 配置action ,prototype为原型,每次生成新的action 解决并发问题-->+ Q0 i/ U; y6 p, I8 w2 R; d+ W
- <bean name="/login" class="com.wireless.web.action.LoginAction" >
8 o7 j8 `6 L' |) g - <property name="userService" ref="userService"></property>
4 i0 j5 c1 I% M - </bean>+ h3 T p8 G9 @1 n' h
- <bean name="/home" class="com.wireless.web.action.HomeAction" >6 s+ Q. v Z8 I( j3 l; L3 a0 T
- <property name="userService" ref="userService"></property> U9 s2 b4 F4 a" V
- </bean>
2 g0 Q9 W+ F- T* R& Z - <bean name="/table" class="com.wireless.web.action.TableAction" >. X. r: T2 k- f7 _3 e y
- <property name="tableService" ref="tableService"></property>2 M5 e, X+ v1 d M& y7 @9 A4 Q
- </bean>9 e! D7 y+ n$ F$ n7 c) l
- <bean name="/menu" class="com.wireless.web.action.MenuAction" >
) A( J' {: }0 ^( \+ f; |, O - <property name="menuService" ref="menuService"></property>
7 @/ L+ X; e5 D' D9 W; ` F/ b - </bean>5 D, {; z: `3 z# s9 m
- <bean name="/order" class="com.wireless.web.action.OrderAction" >
# R0 P; v3 C% r! b! t* S! I - <property name="orderService" ref="orderService"></property>
Y* _2 l! |6 g, o' Z - </bean>
8 r, \ _8 l: a( C' T
) O: h* q5 |" c& G$ @5 L* {- <!-- 配置事务管理器,统一管理sessionFactory的事务 -->6 t: H# }, p" ?
- <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
8 C3 A/ v7 |5 ^. G2 t( F - <property name="sessionFactory" ref="sessionFactory"/>
- y6 T6 A; ~5 ~) Q - </bean>
, n; D4 Y1 D7 v) [ - <!-- 启用事务注解 -->
/ h# ]# h/ T9 a, p' B; j - <tx:annotation-driven transaction-manager="txManager"/># ?5 ^' V( l+ ^% Z( c) I/ R i9 t( g
/ k3 R7 F) ~# s! z; L3 M, i5 D6 W& r- </beans>
2 \9 i9 ] o! j) ] r) [: g
复制代码 4:hibernate.cfg.xml配置文件" V; J" R. k% o6 r" e- N. W) e0 C3 b; B
- <?xml version='1.0' encoding='UTF-8'?>. A0 J2 S$ H4 n: @6 A0 G
- <!DOCTYPE hibernate-configuration PUBLIC8 `" O0 R- b% j V* R3 y( h
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"* v% D% L" p$ L3 y
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
6 N8 t( m( q' _2 y, Y) r - # Z6 s1 h) w8 ^
- <!-- Generated by MyEclipse Hibernate Tools. -->
3 D# @3 Z S* F! ^ - <hibernate-configuration>
- o8 _/ C' s( x% c$ t: x
4 I0 k! j+ Z! O! e) f5 k- <session-factory>
( Q+ P5 M6 R3 ?6 X: U' S& \ - <property name="dialect">
3 P7 l, n# L+ B9 L8 `5 I5 k. C - org.hibernate.dialect.MySQLDialect
" _" l4 N* b& p% f - </property>" P9 j, `$ P/ i. H) X% X% c: f. [6 E( [
- <property name="connection.url">2 |/ q& ^8 ?/ f+ [" J+ i# z
- jdbc:mysql://localhost:3306/struts% `, ~2 W3 D3 H+ H7 ? L
- </property>1 c# `( j: L! m+ i
- <property name="connection.username">root</property>
/ s$ W+ n; R" c - <property name="connection.password">110511</property>: P3 j5 P. \ T( V5 C' ?( `
- <property name="connection.driver_class">
1 b F; `2 Z+ @8 g: t - com.mysql.jdbc.Driver
4 o+ _& N6 q( Q# T& i6 p" c - </property>
6 _5 h& ]. P6 \7 f' @; p. N9 o& o - <property name="myeclipse.connection.profile">mysql</property>
- S5 f' E2 _3 [( |0 Z - <mapping resource="com/wireless/entity/hbm/Usertbl.hbm.xml" />
" e: }+ S5 ]8 Z' {* z+ m( z6 [ - <mapping resource="com/wireless/entity/hbm/Menutypetbl.hbm.xml" />
0 W1 W0 q( ^) a) S. N, r# _- O - <mapping resource="com/wireless/entity/hbm/Tabletbl.hbm.xml" />% G2 ^1 ]1 w/ g# q4 h2 d& Z
- <mapping resource="com/wireless/entity/hbm/Menutbl.hbm.xml" />
2 q, G' [- v$ Q - <mapping resource="com/wireless/entity/hbm/Ordertbl.hbm.xml" />( ^/ f X5 ~6 }* Y
- <mapping resource="com/wireless/entity/hbm/Orderdetailtbl.hbm.xml" />+ {6 _2 C4 h$ W) v( A# F
- 0 r7 F7 a; E4 Q& A: o
- </session-factory>
' |) w+ Y' k5 z+ j3 h
3 o2 v; p/ y: c1 d3 s9 s' Y) g3 ?- </hibernate-configuration>
复制代码 5:界面展示
! v3 Q1 d, C2 t v6 s6 s3 U& n
. ?, k4 B/ N5 c Z
/ p, ?; s% @( ^" x
+ \; k Y5 h& k6 l) ]
- V5 J! k3 V4 H6 H; b9 U9 e2 `
5 S E) i8 J9 M. [8 s) r
6 h- R" H9 P/ e& {
* A, V4 F6 ^1 D* X! P- q2 E; _+ O
. E- Z" Z6 X: n6 I* |0 C
. N. ]5 P4 q6 i( x3 r
& y4 O$ r/ _; l/ q! |& q6 H7 A2 I4 B
6 j% }. z4 `# V& A! q* I% d
. _( }6 L( x# ^' b
9 ] Z* M# l6 n项目源码下载地址:javaWeb三大框架SSH + BootStrap网上订餐系统
' b( P1 x1 h ]$ C
解压密码:
0 A4 ?: K7 T( Z# ?8 n! d' ~0 W/ t! u3 t- W8 {$ ]' L9 h U
|
-
总评分: 帮币 + 5
查看全部评分
|