<
project
xmlns
=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation
=
"http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<
modelVersion
>
4.0.0
modelVersion
>
<
groupId
>
com.lu
groupId
>
<
artifactId
>
maventest3
artifactId
>
<
version
>
0.0.1-SNAPSHOT
version
>
<
packaging
>
war
packaging
>
<
properties
>
<
spring.version
>
4.3.2.RELEASE
spring.version
>
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>
org.springframework
groupId
>
<
artifactId
>
spring-
webmvc
artifactId
>
<
version
>
${spring.version}
version
>
dependency
>
dependencies
>
project
>
|
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
web-app
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns
=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation
=
"http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id
=
"WebApp_ID"
version
=
"2.5"
>
<
display-name
>
springmvc
-
maven
display-name
>
<
welcome-file-list
>
<
welcome-file
>
/
welcome-file
>
welcome-file-list
>
<
servlet
>
<
servlet-name
>
springMVC
servlet-name
>
<
servlet-class
>
org.springframework.web.servlet.DispatcherServlet
servlet-class
>
<
init-param
>
<
param-name
>
contextConfigLocation
param-name
>
<
param-value
>
classpath:springMVC-servlet.xml
param-value
>
init-param
>
<
load-on-startup
>
1
load-on-startup
>
servlet
>
<
servlet-mapping
>
<
servlet-name
>
springMVC
servlet-name
>
<
url-pattern
>
/
url-pattern
>
servlet-mapping
>
<
filter
>
<
filter-name
>
characterEncodingFilter
filter-name
>
<
filter-class
>
org.springframework.web.filter.CharacterEncodingFilter
filter-class
>
<
init-param
>
<
param-name
>
encoding
param-name
>
<
param-value
>
UTF-8
param-value
>
init-param
>
<
init-param
>
<
param-name
>
forceEncoding
param-name
>
<
param-value
>
true
param-value
>
init-param
>
filter
>
<
filter-mapping
>
<
filter-name
>
characterEncodingFilter
filter-name
>
<
url-pattern
>
/*
url-pattern
>
filter-mapping
>
web-app
>
|
@Controller
public
class
IndexController {
/**
* 主页设置 "/"的话默认情况下就访问
*
@return
*/
@RequestMapping
(
"/"
)
public
String home() {
return
"home"
;
}
}
|
file
-
list
>
|
|
1.8
|
|