摘要: applicationContext.xml
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 <? xml version="1.0" encoding="UTF-8" ?>
2 ... 閱讀全文
摘要: applicationContext.xml
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 <? xml version="1.0" encoding="UTF-8" ?>
2 ... 閱讀全文
摘要: applicationContext.xml
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 <? xml version="1.0" encoding="UTF-8" ?>
2 ... 閱讀全文
摘要: applicationContext.xml
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 <? xml version="1.0" encoding="UTF-8" ?>
2 ... 閱讀全文
applicationContext.xml
?1
<?
xml?version="1.0"?encoding="UTF-8"
?>
?2
<!
DOCTYPE?beans?PUBLIC?"-//SPRING//DTD?BEAN//EN"?"http://www.springframework.org/dtd/spring-beans.dtd"
>
?3
<
beans
>
?4
????
<
bean?
id
="dataSource"
?5
????????class
="org.apache.commons.dbcp.BasicDataSource"
>
?6
????????
<
property?
name
="driverClassName"
>
?7
????????????
<
value
>
com.mysql.jdbc.Driver
</
value
>
?8
????????
</
property
>
?9
????????
<
property?
name
="url"
>
10
????????????
<
value
>
jdbc:mysql://localhost:3306/j2ee
</
value
>
11
????????
</
property
>
12
????????
<
property?
name
="username"
>
13
????????????
<
value
>
root
</
value
>
14
????????
</
property
>
15
????
</
bean
>
16
????
<
bean?
id
="sessionFactory"
17
????????class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
>
18
????????
<
property?
name
="dataSource"
>
19
????????????
<
ref?
bean
="dataSource"
?
/>
20
????????
</
property
>
21
????????
<
property?
name
="hibernateProperties"
>
22
????????????
<
props
>
23
????????????????
<
prop?
key
="hibernate.dialect"
>
24
????????????????????org.hibernate.dialect.MySQLDialect
25
????????????????
</
prop
>
26
????????????
</
props
>
27
????????
</
property
>
28
????????
<
property?
name
="mappingResources"
>
29
????????????
<
list
>
30
????????????????
<
value
>
org/me/sshdemo/db/Usertable.hbm.xml
</
value
>
31
????????????
</
list
>
32
????????
</
property
>
33
????
</
bean
>
34
????
<
bean?
id
="UsertableDAO"
?class
="org.me.sshdemo.dao.UsertableDAO"
>
35
????????
<
property?
name
="sessionFactory"
>
36
????????????
<
ref?
bean
="sessionFactory"
?
/>
37
????????
</
property
>
38
????
</
bean
>
39
????
<
bean?
name
="/input"
?class
="org.me.sshdemo.action.InputAction"
40
????????abstract
="false"
?singleton
="false"
?lazy-init
="default"
41
????????autowire
="default"
?dependency-check
="default"
>
42
????????
<
property?
name
="usertableDao"
>
43
????????????
<
ref?
bean
="UsertableDAO"
?
/>
44
????????
</
property
>
45
????
</
bean
>
46
????
<
bean?
name
="/selectAllUsers"
47
????????class
="org.me.sshdemo.action.SelectAllUsersAction"
?abstract
="false"
48
????????singleton
="false"
?lazy-init
="default"
?autowire
="default"
49
????????dependency-check
="default"
>
50
????????
<
property?
name
="usertableDao"
>
51
????????????
<
ref?
bean
="UsertableDAO"
?
/>
52
????????
</
property
>
53
????
</
bean
>
54
</
beans
>
struts-config.xml
?1
<?
xml?version="1.0"?encoding="UTF-8"
?>
?2
<!
DOCTYPE?struts-config?PUBLIC?"-//Apache?Software?Foundation//DTD?Struts?Configuration?1.2//EN"?"http://struts.apache.org/dtds/struts-config_1_2.dtd"
>
?3
<
struts-config
>
?4
????
<
data-sources?
/>
?5
????
<
form-beans
>
?6
????????
<
form-bean?
name
="inputForm"
?type
="org.me.sshdemo.db.Usertable"
?
/>
?7
????
</
form-beans
>
?8
????
<
global-exceptions?
/>
?9
????
<
global-forwards?
/>
10
????
<
action-mappings
>
11
????????
<
action?
attribute
="inputForm"
?input
="/input.jsp"
12
????????????name
="inputForm"
?path
="/input"
?scope
="request"
13
????????????type
="org.springframework.web.struts.DelegatingActionProxy"
>
14
????????????
<
forward?
name
="selectAllUsers"
?path
="/selectAllUsers.do"
15
????????????????redirect
="true"
?
/>
16
????????
</
action
>
17
????????
<
action?
path
="/selectAllUsers"
18
????????????type
="org.springframework.web.struts.DelegatingActionProxy"
>
19
????????????
<
forward?
name
="output"
?path
="/output.jsp"
?redirect
="true"
?
/>
20
????????
</
action
>
21
????
</
action-mappings
>
22
????
<
message-resources?
parameter
="org.me.sshdemo.ApplicationResources"
?
/>
23
????
<
plug-in
24
????????
className
="org.springframework.web.struts.ContextLoaderPlugIn"
>
25
????????
<
set-property?
property
="contextConfigLocation"
26
????????????value
="/WEB-INF/applicationContext.xml"
?
/>
27
????
</
plug-in
>
28
</
struts-config
>
Usertable.hbm.xml
?1
<?
xml?version="1.0"?encoding="utf-8"
?>
?2
<!
DOCTYPE?hibernate-mapping?PUBLIC?"-//Hibernate/Hibernate?Mapping?DTD?3.0//EN"
?3
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
?4
<!--
?
?5
????Mapping?file?autogenerated?by?MyEclipse?-?Hibernate?Tools
?6
-->
?7
<
hibernate-mapping
>
?8
????
<
class?
name
="org.me.sshdemo.db.Usertable"
?table
="usertable"
>
?9
????????
<
id?
name
="userid"
?type
="java.lang.Integer"
>
10
????????????
<
column?
name
="userid"
?
/>
11
????????????
<
generator?
class
="native"
?
/>
12
????????
</
id
>
13
????????
<
property?
name
="username"
?type
="java.lang.String"
>
14
????????????
<
column?
name
="username"
?length
="20"
?
/>
15
????????
</
property
>
16
????????
<
property?
name
="userpwd"
?type
="java.lang.String"
>
17
????????????
<
column?
name
="userpwd"
?length
="20"
?
/>
18
????????
</
property
>
19
????
</
class
>
20
</
hibernate-mapping
>
完整程序:http://zhangjingqiang.javaeye.com/blog/51798


?1

?2

?3

?4

?5

?6

?7

?8

?9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54



?1

?2

?3

?4

?5

?6

?7

?8

?9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28



?1

?2

?3

?4

?5

?6

?7

?8

?9

10

11

12

13

14

15

16

17

18

19

20
