TA的每日心情 | 衰 2021-2-2 11:21 |
---|
签到天数: 36 天 [LV.5]常住居民I
|
1.简介 后端基于spring, struts1和hibernate,前台用bootstrap实现。
3 S2 @' ~& D0 A( f j3 u 实现的功能也比较少,基本的crud操作,文件上传,ajax异步刷新等。
; ~( A2 E! G+ c9 X7 A3 R/ F/ g( o9 ^ 2.代码结构
+ t: v; i% @2 R* Q& z" |: B" W5 l
) F# h4 v% _% E& H
3: applicationContext.xml配置文件
* U% ^0 T+ U0 j2 H- <?xml version="1.0" encoding="utf-8"?>
2 O* E: g: V; l! d) F' p - <beans xmlns="http://www.springframework.org/schema/beans"# n3 F4 |' L& K ~! q h
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"5 Y7 j4 F: P1 m: Y
- xmlns:context="http://www.springframework.org/schema/context"6 T0 F3 \3 b4 S* ]1 v J7 H
- xmlns:tx="http://www.springframework.org/schema/tx"/ w; E" x! h3 `* j4 z
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd/ F: }6 T# D& }2 M
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd2 f& {9 G5 V$ D3 l6 c
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
" D3 S- Y5 v- M/ g - <!-- 启用注解扫描 -->
8 c+ }$ R% G7 I+ R% g - <context:annotation-config/>
% {' [3 k6 g3 @0 R
7 ?1 @. C% [; B( ~: z- <!-- 配置数据源 -->
9 H, |$ [$ f0 ]$ l; @. f; k0 K - <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
( v+ l- C" n9 @- x - <property name="driverClassName" value="com.mysql.jdbc.Driver" />; O' t) _1 t% [& j! Y' ]- e
- <property name="url" value="jdbc:mysql://localhost:3306/wireless"/>3 g4 d/ m1 F1 M8 f( i0 u6 P( v+ Y8 _
- <property name="username" value="root"/>7 @. x9 S/ O4 l8 j, r# b
- <property name="password" value="110511"/>
/ z2 M( g. @' i7 Q$ p/ M0 c - </bean>4 o; d1 C6 w6 |, i( x7 j3 I; z
- <!-- 配置会话工厂 -->% f- I" \% N% c9 }2 G
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
5 L) Z: F; ]9 u$ j- M' U" c+ U - <!-- 设置数据源 --> j* Z) o( J" _9 T4 M- J
- <property name="dataSource" ref="dataSource" />" ] T7 Z9 {7 G4 d l' z
- <!-- 配置映射文件 -->
0 y0 |9 I4 U+ {- r- h. Q - <property name="mappingResources">
5 T* g7 Z+ j/ \/ J V& j7 P" R. X/ } - <list>" W! A; C3 A H# I- q
- <value>com/wireless/entity/hbm/Usertbl.hbm.xml</value>" b! `* X4 ]) g, ` x% f% Y
- <value>com/wireless/entity/hbm/Menutypetbl.hbm.xml</value>3 U2 H( L2 C6 T+ b) J
- <value>com/wireless/entity/hbm/Tabletbl.hbm.xml</value>
6 x7 E- q: Z/ b - <value>com/wireless/entity/hbm/Menutbl.hbm.xml</value>
* {$ g4 {8 @7 m' B% x5 P7 p6 m - <value>com/wireless/entity/hbm/Ordertbl.hbm.xml</value>+ j+ ?$ ]- C* S) v+ ?1 |- K
- <value>com/wireless/entity/hbm/Orderdetailtbl.hbm.xml</value>
% K! i- @% u* P! N - </list>
, k3 U/ O7 u6 P1 P7 _/ _ - </property>
8 j* ]; n8 H7 c: z( ^ - <property name="hibernateProperties">2 H4 m4 {% _! A( p9 G) y
- <props>2 I! o5 X. G5 t: D" t
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>, S1 H3 Z* L( b
- <prop key="hibernate.hbm2ddl.auto">update</prop>- W9 n0 ^" I. {4 p$ B2 N* ?6 p& o
- <prop key="hibernate.show_sql">true</prop>5 x; f t0 A5 \ e0 Q# V' K' \9 D; V
- <prop key="hibernate.cache.use_second_level_cache">true</prop>. O; A" T; l* w
- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
) U' [/ w! j/ b j* l4 Z8 O' i; s - <prop key=" hibernate.generate_statistics">true</prop>
1 [- U. W0 u) ?( p% Z& J - # V" r b3 Z7 R G
- </props>/ ]" Z3 R0 p5 R3 _6 e7 a
- </property>+ A- l4 ~. B: Q, I7 ~5 W
- </bean>9 |( `" a, i1 j! x- l% I2 D5 @
1 g7 n$ s% O9 @" {/ s- <!-- 配置Service -->
, t2 C, y/ ~4 e$ d1 Z' R" J - % k: |0 K" ^* k# s
- <!-- 配置Service -->4 f: c6 D) c$ o, L
- <bean id="userService" class="com.wireless.web.service.impl.UserServiceImpl" />
3 N4 r8 B. ]1 ^2 ?: S7 W) M - <bean id="tableService" class="com.wireless.web.service.impl.TableServiceImpl" />
- }" A: a ]' J3 n( d - <bean id="menuService" class="com.wireless.web.service.impl.MenuServiceImpl" />' f9 N5 P+ C& c" |; L
- <bean id="orderService" class="com.wireless.web.service.impl.OrderServiceImpl" />
9 D0 Y4 |6 [6 X8 z' `- n. n
) q$ z! _# e. w0 w- <!-- 配置action ,prototype为原型,每次生成新的action 解决并发问题-->/ U& N3 I# w6 f
- <bean name="/login" class="com.wireless.web.action.LoginAction" >1 }; u- X1 Z. j8 L- t
- <property name="userService" ref="userService"></property>
$ R: Y* \' x6 Y% z- [& l, o- @ - </bean>4 _, j7 r# @' D, _
- <bean name="/home" class="com.wireless.web.action.HomeAction" >
. c6 |6 T6 L. c! S - <property name="userService" ref="userService"></property>5 C& [, b6 Q% b7 x
- </bean>
1 K5 D7 z2 o# ]# U8 l7 K; i. v4 b - <bean name="/table" class="com.wireless.web.action.TableAction" >! \' _: ^# `; S3 [4 ~
- <property name="tableService" ref="tableService"></property>' W: t3 _/ z! O& t
- </bean>" ]& ]$ Q& G( D) [; H, D% L
- <bean name="/menu" class="com.wireless.web.action.MenuAction" >" c' I" _ c( g; N! e
- <property name="menuService" ref="menuService"></property>; j g$ P- k1 y& y5 w W9 b/ B
- </bean>
5 u/ Y: S! L4 ~! X - <bean name="/order" class="com.wireless.web.action.OrderAction" >6 ^! ^1 m9 `9 T/ ]* X6 @' `0 p3 c
- <property name="orderService" ref="orderService"></property>3 n3 o; o, L( f2 n* J* {
- </bean>
9 m! a3 j, Z) ]
2 V, x* M, T2 t ]0 ^( S, i- <!-- 配置事务管理器,统一管理sessionFactory的事务 -->/ L# L5 w4 h# d! W z- z6 F# r
- <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">1 T4 r) e8 `+ z' {" t+ g' A
- <property name="sessionFactory" ref="sessionFactory"/>6 w# s: i* v; e4 N3 N
- </bean>' |+ @- a% C: K* n# u
- <!-- 启用事务注解 --># \. | X+ Z* a j- G
- <tx:annotation-driven transaction-manager="txManager"/>
* |9 W: ^) X P; Q7 [. @) q - : ?1 U2 B7 A+ V+ _; ~0 G, Q
- </beans>8 Q) t, _0 t9 j; r
复制代码 4:hibernate.cfg.xml配置文件 F3 b& B3 x9 P1 k+ H* i
- <?xml version='1.0' encoding='UTF-8'?>
0 C! U2 J5 @& y - <!DOCTYPE hibernate-configuration PUBLIC
0 A* r; |. L+ ]# [- r* ?# v - "-//Hibernate/Hibernate Configuration DTD 3.0//EN"9 F* b% j* S9 X- F) C
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
7 l7 o* k D- x7 n! w) Q - * |$ H" R+ I& N% B
- <!-- Generated by MyEclipse Hibernate Tools. -->1 t' b) L9 E: G7 G/ c# f8 m
- <hibernate-configuration>3 I. w3 L9 V& l/ x0 e
- 9 w" ^+ l# M2 X# W0 @: a4 Y! ~
- <session-factory>
: X8 r S! T& a) I) a7 m - <property name="dialect">9 Q5 P# s# `! ~. I
- org.hibernate.dialect.MySQLDialect
- Z% t8 l& P |; k- ~ u2 Y6 G4 \ - </property>/ k$ o' i" Z, ^% R% v7 J/ Q3 \: A
- <property name="connection.url">
4 f& P# W0 _+ I, q# \7 t" H- P$ Z - jdbc:mysql://localhost:3306/struts
; Q, i' k) q( t1 e' n$ |# U1 v - </property>( ^( X1 V$ |. w) C
- <property name="connection.username">root</property>
! @: P0 W: K! ]; k" H0 a) \ - <property name="connection.password">110511</property>2 V9 k1 C4 R; e/ B F5 z1 D
- <property name="connection.driver_class">
9 R- ~4 `+ @4 t( s4 P0 h3 X - com.mysql.jdbc.Driver+ D, o% [, x; {# ~
- </property>
& n) }7 H) f* G$ h& O - <property name="myeclipse.connection.profile">mysql</property>. z% b% \& w! u2 v
- <mapping resource="com/wireless/entity/hbm/Usertbl.hbm.xml" />
' B$ @9 W/ p3 a! y. e& }( Q; D" _ - <mapping resource="com/wireless/entity/hbm/Menutypetbl.hbm.xml" />
/ |+ {3 ?2 p; q - <mapping resource="com/wireless/entity/hbm/Tabletbl.hbm.xml" />
" y& e" w7 T! @) B% O4 M( l - <mapping resource="com/wireless/entity/hbm/Menutbl.hbm.xml" />
& d8 {* c9 t4 a) c; x - <mapping resource="com/wireless/entity/hbm/Ordertbl.hbm.xml" />0 C5 i# a. ?. t) R) T; x% A7 ~
- <mapping resource="com/wireless/entity/hbm/Orderdetailtbl.hbm.xml" />- v+ D% _% w' D4 E
- 7 {% p; k; p$ W6 Y
- </session-factory>
; F' g/ E/ [/ a5 J* O9 X - & X2 n7 L0 Y$ z8 F0 L L P
- </hibernate-configuration>
复制代码 5:界面展示8 ^- n8 ?1 t8 M8 q& E) J
+ |" R3 v" Z& ?
' e; A e/ R/ d3 r# T: _
; n* b, S4 ~5 V) a
1 `' o& `& i" u
' \& t2 l) ~1 R7 I( K
6 f1 r2 }! M3 l8 D8 _% Y6 ^
' m; R8 P; X! L
6 F( A( l1 Y9 A5 G5 ?$ u
' J9 G+ J. U4 u% Y. D
0 R* M7 q5 Z {6 t
; Z5 ^" t9 E+ U5 g
6 m$ C1 u3 r; W }; B4 A( _! S! r+ p
项目源码下载地址:javaWeb三大框架SSH + BootStrap网上订餐系统
+ l* t2 a$ \( ~0 z2 F, W
解压密码:# M0 A/ y6 _$ \" `, |3 ]: u- h* E
+ L$ U% [9 h, I: J/ n# C0 a7 p
|
-
总评分: 帮币 + 5
查看全部评分
|