File tree 8 files changed +117
-7
lines changed
8 files changed +117
-7
lines changed Original file line number Diff line number Diff line change 45
45
<a href =" <%= context % > /actions/Course_delete" >删除课程</a >
46
46
<br />通配符结束ActionWildcard
47
47
<br >
48
+ <br />ActionAttrParamInput开始 使用action属性接收参数 和ActionMethod开始
49
+ <br >使用action属性接收参数
50
+ <a href =" user/user!add?name=a&age=8" >添加用户</a >
51
+ <br />ActionAttrParamInput结束使用action属性接收参数
52
+ <br >
53
+ 使用Domain Model接收参数<a href =" user/user!add?user.name=a&user.age=8" >添加用户</a >
48
54
49
- <p >Loading ...</p >
50
55
51
56
</body >
52
57
</html >
Original file line number Diff line number Diff line change 6
6
<meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
7
7
<title >Insert title here</title >
8
8
</head >
9
- <body >User Add Success!
9
+ <body >
10
+ User Add Success!
10
11
</body >
11
12
</html >
Original file line number Diff line number Diff line change 6
6
<meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
7
7
<title >Insert title here</title >
8
8
</head >
9
- <body >User Add Success!
9
+ <body >
10
+ User Add Success!
10
11
</body >
11
12
</html >
Original file line number Diff line number Diff line change 74
74
</package >
75
75
<!-- path结束 -->
76
76
77
- <!-- ActionMethod开始 -->
77
+ <!-- ActionMethod开始 ActionAttrParamInput -->
78
78
<package name =" user" extends =" struts-default" namespace =" /user" >
79
79
<action name =" userAdd" class =" com.struts2.front.action.UserAction"
80
80
method=" add" >
88
88
</result >
89
89
</action >
90
90
</package >
91
- <!-- ActionMethod结束 -->
91
+ <!-- ActionMethod结束 ActionAttrParamInput -->
92
92
93
93
<!-- 通配符开始 ActionWildcard -->
94
94
<package name =" actions" extends =" struts-default" namespace =" /actions" >
Original file line number Diff line number Diff line change 15
15
package com .struts2 .front .action ;
16
16
17
17
import com .opensymphony .xwork2 .ActionSupport ;
18
+ import com .struts2 .front .model .User ;
18
19
19
20
/**
20
21
* @filename 文件名称:UserAction.java
21
22
* @contents 内容摘要:
22
23
*/
23
24
public class UserAction extends ActionSupport {
25
+ private String name ;
26
+ private int age ;
27
+
28
+ public String getName () {
29
+ return name ;
30
+ }
31
+
32
+ public void setName (String name ) {
33
+ this .name = name ;
34
+ }
35
+
36
+ public int getAge () {
37
+ return age ;
38
+ }
39
+
40
+ public void setAge (int age ) {
41
+ this .age = age ;
42
+ }
43
+
44
+ private User user ;
45
+
46
+ public User getUser () {
47
+ return user ;
48
+ }
49
+
50
+ public void setUser (User user ) {
51
+ this .user = user ;
52
+ }
53
+
24
54
public String add () {
55
+ // System.out.println("name:" + name);
56
+ // System.out.println("age:" + age);
57
+ // System.out.println("name:" + user.getName());
58
+ // System.out.println("age:" + user.getAge());
25
59
return SUCCESS ;
26
60
}
27
61
Original file line number Diff line number Diff line change
1
+ /*************************************************************************************************
2
+ * 版权所有 (C)2015
3
+ *
4
+ * 文件名称:UserDTO.java
5
+ * 内容摘要:UserDTO.java
6
+ * 当前版本:TODO
7
+ * 作 者:李加蒙
8
+ * 完成日期:2016年8月16日 下午5:30:27
9
+ * 修改记录:
10
+ * 修改日期:2016年8月16日 下午5:30:27
11
+ * 版 本 号:
12
+ * 修 改 人:
13
+ * 修改内容:
14
+ ************************************************************************************************/
15
+ package com .struts2 .front .dto ;
16
+ /**
17
+ @filename 文件名称:UserDTO.java
18
+ @contents 内容摘要:
19
+ */
20
+ public class UserDTO {
21
+
22
+ }
23
+
Original file line number Diff line number Diff line change
1
+ /*************************************************************************************************
2
+ * @版权所有 (C)2015, 星火工作室
3
+ *
4
+ * @文件名称:User.java
5
+ * @内容摘要:用户bean
6
+ * @当前版本: TODO
7
+ * @作 者: 李加蒙
8
+ * @完成日期:2015年9月20日 下午6:25:05
9
+ * @修改记录:
10
+ * @修改日期:2015年9月20日 下午6:25:05
11
+ * @版 本 号:
12
+ * @修 改 人:
13
+ * @修改内容:
14
+ ************************************************************************************************/
15
+
16
+ package com .struts2 .front .model ;
17
+
18
+ import java .io .Serializable ;
19
+
20
+ /**
21
+ * @filename 文件名称:User.java
22
+ * @contents 内容摘要:用户注册bean
23
+ */
24
+ public class User implements Serializable {
25
+
26
+ private static final long serialVersionUID = 1L ;
27
+
28
+ private String name ;
29
+ private int age ;
30
+
31
+ public String getName () {
32
+ return name ;
33
+ }
34
+
35
+ public void setName (String name ) {
36
+ this .name = name ;
37
+ }
38
+
39
+ public int getAge () {
40
+ return age ;
41
+ }
42
+
43
+ public void setAge (int age ) {
44
+ this .age = age ;
45
+ }
46
+ }
Original file line number Diff line number Diff line change 74
74
</package >
75
75
<!-- path结束 -->
76
76
77
- <!-- ActionMethod开始 -->
77
+ <!-- ActionMethod开始 ActionAttrParamInput -->
78
78
<package name =" user" extends =" struts-default" namespace =" /user" >
79
79
<action name =" userAdd" class =" com.struts2.front.action.UserAction"
80
80
method=" add" >
88
88
</result >
89
89
</action >
90
90
</package >
91
- <!-- ActionMethod结束 -->
91
+ <!-- ActionMethod结束 ActionAttrParamInput -->
92
92
93
93
<!-- 通配符开始 ActionWildcard -->
94
94
<package name =" actions" extends =" struts-default" namespace =" /actions" >
You can’t perform that action at this time.
0 commit comments