File tree 8 files changed +324
-10
lines changed
java/com/lj/spring/controller
8 files changed +324
-10
lines changed Original file line number Diff line number Diff line change 29
29
</configuration >
30
30
</facet >
31
31
</component >
32
- <component name =" NewModuleRootManager" LANGUAGE_LEVEL =" JDK_1_6 " >
32
+ <component name =" NewModuleRootManager" LANGUAGE_LEVEL =" JDK_1_5 " >
33
33
<output url =" file://$MODULE_DIR$/target/classes" />
34
34
<output-test url =" file://$MODULE_DIR$/target/test-classes" />
35
35
<content url =" file://$MODULE_DIR$" >
Original file line number Diff line number Diff line change 15
15
16
16
<properties >
17
17
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
18
+ <dao .target.dir>src/main/java</dao .target.dir>
19
+ <mybatis .generator.configurationFile>${basedir} /src/main/resources/generatorConfig.xml</mybatis .generator.configurationFile>
18
20
</properties >
19
21
20
22
<dependencies >
26
28
</dependency >
27
29
</dependencies >
28
30
31
+ <build >
32
+ <plugins >
33
+ <plugin >
34
+ <groupId >org.mybatis.generator</groupId >
35
+ <artifactId >mybatis-generator-maven-plugin</artifactId >
36
+ <version >1.3.5</version >
37
+ <executions >
38
+ <execution >
39
+ <id >Generate MyBatis Artifacts</id >
40
+ <goals >
41
+ <goal >generate</goal >
42
+ </goals >
43
+ </execution >
44
+ </executions >
45
+ </plugin >
46
+ </plugins >
47
+ </build >
48
+
29
49
</project >
Original file line number Diff line number Diff line change 11
11
<content url =" file://$MODULE_DIR$" >
12
12
<sourceFolder url =" file://$MODULE_DIR$/src/main/java" isTestSource =" false" />
13
13
<sourceFolder url =" file://$MODULE_DIR$/src/test/java" isTestSource =" true" />
14
+ <sourceFolder url =" file://$MODULE_DIR$/src/main/resources" type =" java-resource" />
14
15
<excludeFolder url =" file://$MODULE_DIR$/target" />
15
16
</content >
16
17
<orderEntry type =" inheritedJdk" />
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 6
6
import org .apache .log4j .Logger ;
7
7
import org .springframework .beans .factory .annotation .Autowired ;
8
8
import org .springframework .stereotype .Controller ;
9
+ import org .springframework .web .bind .annotation .ModelAttribute ;
10
+ import org .springframework .web .bind .annotation .RequestHeader ;
9
11
import org .springframework .web .bind .annotation .RequestMapping ;
10
12
import org .springframework .web .bind .annotation .RequestParam ;
11
13
import org .springframework .web .servlet .ModelAndView ;
@@ -126,9 +128,18 @@ public ModelAndView updateByRequest(HttpServletRequest req){
126
128
}
127
129
128
130
@ RequestMapping ("/updateByPoJo" )
129
- public ModelAndView updateByPoJo (User user ){
130
- log .debug (user );
131
+ public ModelAndView updateByPoJo (HttpServletRequest req , User user ){
132
+
133
+ try {
134
+ req .setCharacterEncoding ("UTF-8" );
135
+ } catch (UnsupportedEncodingException e ) {
136
+ e .printStackTrace ();
137
+ }
131
138
139
+ String name = req .getParameter ("name" );
140
+ log .debug ("打印姓名: " + name );
141
+
142
+ log .debug (user );
132
143
userService .updateUser (user );
133
144
return showList ();
134
145
}
Original file line number Diff line number Diff line change 1
- <%@ page contentType =" text/html;charset=UTF-8" %>
2
- <%@page pageEncoding =" UTF-8" %>
1
+ <%@ page contentType =" text/html;charset=UTF-8" pageEncoding =" UTF-8" %>
3
2
<% request. setCharacterEncoding(" UTF-8" ); % >
4
3
5
4
<html >
6
5
<head >
7
- <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
8
6
<title >编辑用户详情</title >
7
+ <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
9
8
</head >
10
9
<body >
11
10
12
11
<h1 >使用req获取表单数据</h1 >
13
- <form id =" updateByRequestForm" action =" ${ pageContext. request. contextPath } /user/updateByRequest" method =" post" accept-charset = " UTF-8 " >
12
+ <form id =" updateByRequestForm" action =" ${ pageContext. request. contextPath } /user/updateByRequest" method =" post" >
14
13
<input type =" hidden" name =" id" value =" ${ user. id } " >
15
14
<table border =" 1" >
16
15
<tr >
34
33
</form >
35
34
5
36
35
<h1 >使用User获取表单数据</h1 >
37
- <form id =" updateByPoJoForm" action =" ${ pageContext. request. contextPath } /user/updateByPoJo" method =" post" accept-charset = " UTF-8 " >
36
+ <form id =" updateByPoJoForm" action =" ${ pageContext. request. contextPath } /user/updateByPoJo" method =" post" >
38
37
<input type =" hidden" name =" id" value =" ${ user. id } " >
39
38
<table border =" 1" >
40
39
<tr >
You can’t perform that action at this time.
0 commit comments