TA的每日心情 | 衰 2021-2-2 11:21 |
---|
签到天数: 36 天 [LV.5]常住居民I
|
1.简介 后端基于spring, struts1和hibernate,前台用bootstrap实现。
5 ~6 b/ o+ Q, n% g+ W0 G$ F! k 实现的功能也比较少,基本的crud操作,文件上传,ajax异步刷新等。6 m# L3 d: ^) w" y0 T/ j6 S
2.代码结构
# D8 l1 Q/ z! L8 k. O( l4 Y" H! u+ E- b7 R- q" B
3: applicationContext.xml配置文件( u, o% s$ p5 J0 r* a( [0 G. M3 ^
- <?xml version="1.0" encoding="utf-8"?>
2 ?# Y0 A" _5 Z3 W2 ` f1 g1 E - <beans xmlns="http://www.springframework.org/schema/beans"
) @5 \+ R/ V6 j! ^% ^* r" E - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") d1 y# B/ q# u/ y0 l
- xmlns:context="http://www.springframework.org/schema/context"" F0 U) _% E7 U I
- xmlns:tx="http://www.springframework.org/schema/tx"; g! q: F+ G% \5 f! K" Z9 a
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
: N m. i" M1 G" b9 l - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
( k; F& Y* ]2 y2 M/ u - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">' }* `0 i; X2 f* j7 c1 P
- <!-- 启用注解扫描 -->' c' {/ O R8 |
- <context:annotation-config/>& z- j8 z; y! k7 e* G& t
- 6 _8 A9 r7 i! {
- <!-- 配置数据源 -->" o: |( s/ [ d5 b' ^- D* ~$ o
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">7 ^& m6 r0 j' s' o
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
5 K% W0 E, U, _+ u3 N& | - <property name="url" value="jdbc:mysql://localhost:3306/wireless"/>) f2 s4 Y' M9 L+ R3 w
- <property name="username" value="root"/>
) X* R& D, x- L$ p } - <property name="password" value="110511"/>. H$ V* Q: p& d ^" |
- </bean>. V" G( L1 q& r8 Q7 { h" \7 @2 F/ c
- <!-- 配置会话工厂 -->! t( K: @, E* O# U/ r" Z3 T
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">/ s, P9 F E/ z- I
- <!-- 设置数据源 -->% `1 W+ G% P8 p3 w0 G( g' A( {
- <property name="dataSource" ref="dataSource" />, T8 ?9 `/ Q3 G9 I: H0 {
- <!-- 配置映射文件 -->
5 Z& V9 c, P! h8 X! ^ - <property name="mappingResources">$ O6 ?4 J( ?+ k) M' g, `" |
- <list>7 }# i! [( M; ^# T9 z* D. W# l3 P
- <value>com/wireless/entity/hbm/Usertbl.hbm.xml</value>
( k9 T4 b( p4 g' h4 g+ q - <value>com/wireless/entity/hbm/Menutypetbl.hbm.xml</value> d) {7 @' E' K* R
- <value>com/wireless/entity/hbm/Tabletbl.hbm.xml</value>
! E+ ?; ^8 j% m/ P, J% W - <value>com/wireless/entity/hbm/Menutbl.hbm.xml</value>" ]( J+ ^0 `' i" n& h E
- <value>com/wireless/entity/hbm/Ordertbl.hbm.xml</value>
1 q( p4 c0 n/ u8 n, u9 b' a: n - <value>com/wireless/entity/hbm/Orderdetailtbl.hbm.xml</value>
) P! i& q7 h$ I9 Q; n; z/ | - </list>
) L, ?; e) W: H+ O }+ C - </property>
1 I1 k/ Z/ ^" J/ Y - <property name="hibernateProperties">
+ `: h& l* S6 W0 h' A. j - <props>6 i! N# j! w ~+ M0 r
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> @/ E4 ^7 `! \# m0 i; N
- <prop key="hibernate.hbm2ddl.auto">update</prop>! n8 P4 G- W/ R
- <prop key="hibernate.show_sql">true</prop>* ~3 K" u- e* w, s- I
- <prop key="hibernate.cache.use_second_level_cache">true</prop>
; j; Q5 d, E9 w- N - <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
# @$ H J/ }$ f3 X' {9 ~ - <prop key=" hibernate.generate_statistics">true</prop>" O4 @2 H# @/ ^7 j
- ; x! y! L I+ n8 I$ J# P
- </props>2 i# D# B" y% h: d, ^, m7 t$ z
- </property>
' u$ G% u- ?. W% ?( |) { - </bean># N( E* O# ]; ~' Q& x' ?) k. k! h
- 3 B4 e+ v+ p- ?, D
- <!-- 配置Service -->
$ }7 B! U5 L3 K9 i' } - 2 B: Q% n% \# o+ P& K& O
- <!-- 配置Service --># N/ k* u0 L" D% f1 D- e
- <bean id="userService" class="com.wireless.web.service.impl.UserServiceImpl" />8 M1 N4 v, E. N e/ ?
- <bean id="tableService" class="com.wireless.web.service.impl.TableServiceImpl" />/ u3 k: X. I( }( H" c
- <bean id="menuService" class="com.wireless.web.service.impl.MenuServiceImpl" />
: B9 U8 u* c9 @; t6 t7 M - <bean id="orderService" class="com.wireless.web.service.impl.OrderServiceImpl" />
9 s" Q" M+ p+ ^1 G" x( g% R
; d# p, E# N; p. H2 V- <!-- 配置action ,prototype为原型,每次生成新的action 解决并发问题-->" E0 Q9 t' ^# t' M' {
- <bean name="/login" class="com.wireless.web.action.LoginAction" >
4 v7 _1 ~6 U, ]4 Z - <property name="userService" ref="userService"></property>
( Q N4 o2 ?, d: ^# x$ | - </bean> C& i' e1 ]8 M* e1 P2 K! h* t
- <bean name="/home" class="com.wireless.web.action.HomeAction" >
0 X6 C4 a$ e9 V/ f ?4 v - <property name="userService" ref="userService"></property>
3 C3 g0 v) h) b- C( i2 ]4 V - </bean>
5 e7 R. N; H2 H! K% \' M - <bean name="/table" class="com.wireless.web.action.TableAction" >6 {. A: ~) P( z( p; O7 X
- <property name="tableService" ref="tableService"></property>
- ?! ^$ F2 M6 Z - </bean>
7 M( c5 R& T( R2 S4 t - <bean name="/menu" class="com.wireless.web.action.MenuAction" >
% \- o! h& D H4 e# a; c - <property name="menuService" ref="menuService"></property>
( N4 u; L9 g6 R) r - </bean>" E+ }# Y, A3 s' m9 ]/ X
- <bean name="/order" class="com.wireless.web.action.OrderAction" >
9 b% P# \4 u5 i4 t - <property name="orderService" ref="orderService"></property>: @6 Z+ S# K E J/ n4 B
- </bean>
: |7 ^) X6 X$ C! M* ]$ K
6 N+ Z+ x; d" z4 ?) P6 d1 Z \- <!-- 配置事务管理器,统一管理sessionFactory的事务 -->
. b9 F' @; r8 c+ T - <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
8 \8 W ?5 E$ d9 s: I5 Y6 ?) ` - <property name="sessionFactory" ref="sessionFactory"/>1 f- G) [) L* D9 u
- </bean>* b. _$ t1 _/ t) q! Y
- <!-- 启用事务注解 --># O7 a# V- u* D$ T% X: d# d
- <tx:annotation-driven transaction-manager="txManager"/>! N0 r/ p! h/ _7 ]
, ~) r8 X9 R) \9 t: ]6 J- </beans>
! ^/ K/ d3 r% V' v8 E
复制代码 4:hibernate.cfg.xml配置文件5 x' b- T1 e8 z5 u
- <?xml version='1.0' encoding='UTF-8'?>/ C0 G6 R1 |# H
- <!DOCTYPE hibernate-configuration PUBLIC) s) B( \; r7 j5 a
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"9 ?) U( ~. ]3 V( L8 H
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">) u3 v0 U, E$ y" P5 b! p# f
' c8 I t7 Y7 _$ m* @4 E- <!-- Generated by MyEclipse Hibernate Tools. -->, E1 Y8 j5 Q2 E7 E+ k
- <hibernate-configuration># J5 q, E d+ b6 n q
' d/ l4 x9 F% p/ _5 u- <session-factory>" w9 b9 T6 Y" n6 J+ x0 H3 C
- <property name="dialect">9 B( ^" [( |- r. E4 v8 w
- org.hibernate.dialect.MySQLDialect, X# w( ?% ~. U# I% I# e+ A
- </property>
& E4 o) k* m' M! h - <property name="connection.url">3 ^4 K$ l. R1 i8 g8 r. g2 O
- jdbc:mysql://localhost:3306/struts: S; Y- e" ]5 `# C/ G
- </property>& k& S6 @* |2 I& d
- <property name="connection.username">root</property>
4 J" \% z8 t9 Z7 k - <property name="connection.password">110511</property>
5 z+ h' m8 J* o9 E& z |# p - <property name="connection.driver_class">; p9 H+ i4 W6 T( b. E
- com.mysql.jdbc.Driver4 k3 I& P7 Y4 C' b2 [7 ?3 m
- </property>
% `& u; O& u( i - <property name="myeclipse.connection.profile">mysql</property>
2 D) R3 D& F' I/ I& ? - <mapping resource="com/wireless/entity/hbm/Usertbl.hbm.xml" />
! f1 [8 u% |. K- x7 p, _ - <mapping resource="com/wireless/entity/hbm/Menutypetbl.hbm.xml" />8 R! ]" Q6 ~" o7 \( O; V4 W
- <mapping resource="com/wireless/entity/hbm/Tabletbl.hbm.xml" />
& y; t( M- `/ W - <mapping resource="com/wireless/entity/hbm/Menutbl.hbm.xml" />. ]" x2 Q% F+ M' X6 D' V
- <mapping resource="com/wireless/entity/hbm/Ordertbl.hbm.xml" />
$ |5 \/ I; m3 F2 J - <mapping resource="com/wireless/entity/hbm/Orderdetailtbl.hbm.xml" />& u# Q$ B; M4 ]
- ' ^4 \! t( `5 P- c6 s/ h% K
- </session-factory>$ y5 I6 c& ?! C, H, c, s. @
- ' P8 M# ~: k% v9 B
- </hibernate-configuration>
复制代码 5:界面展示
' f, I2 J- }1 E3 }
+ ^5 P" Z! Y3 E U, e( F+ |
! j5 q; h% a5 j
0 E u# z. c! r/ X* X5 @
' E6 B4 g) o* Q4 T9 u, v
( |. Y$ I1 K( o5 X
! B v. l$ {3 X% p( n- p
# K- i8 h. o7 v* B8 B6 H
1 \) l$ q* J5 ]
6 x/ F! H8 m5 y0 n5 b, I& n3 ?# ~! y. D+ h
0 m$ o' k; O% e, k& {& L
, I7 s1 m f" F& {7 n
0 }- F( S8 f# ]) g
; X) K% a/ h! f, t项目源码下载地址:javaWeb三大框架SSH + BootStrap网上订餐系统
1 r% [) |) a% d# y
解压密码:* S3 S( B$ O8 \7 B( Y; F; ~
5 `1 {. T/ \" U. ?- H( o |
-
总评分: 帮币 + 5
查看全部评分
|