Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25cf76f

Browse files
[update] 更新配置文件
1 parent 0d26db1 commit 25cf76f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎web/src/main/java/demo/web/controller/PageController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
@Controller
1616
public class PageController {
1717
/**
18-
* 跳转至demo.html
18+
* 跳转至demo.html(静态页面)
1919
*/
2020
@RequestMapping("/demo1")
2121
public String demoPage() {
22-
return "demo";
22+
return "/static/demo";
2323
}
2424
}

‎web/src/main/resources/application.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 参考博客:https://www.cnblogs.com/chen-lhx/p/7592523.html
12
# 自定义常量
23
user=Alice
34
# 指定配置环境(开发dev/生产prod),不指定则使用本文件
@@ -14,12 +15,15 @@ spring.servlet.multipart.max-request-size=100MB
1415
############### see: https://my.oschina.net/scjelly/blog/523705
1516
# 设置session的cookie最长有效时间, -1表示关闭浏览器前均有效
1617
server.servlet.session.cookie.max-age=-1S
17-
# 定位页面的目录到static/下,针对controller,见PageController
18+
# 配置页面前缀
1819
spring.mvc.view.prefix=/
20+
# 页面后缀
1921
spring.mvc.view.suffix=.html
20-
spring.mvc.static-path-pattern=/**
22+
# 配置静态资源路径
23+
spring.mvc.static-path-pattern=/static/**
2124
# 文件上传路径
2225
web.upload-path=/home/upload
26+
# 静态资源路径
2327
spring.resources.static-locations=classpath:/static,classpath:/resources,file:${web.upload-path}
2428
# 让controller输出的json格式更美观(格式化)
2529
spring.jackson.serialization.indent-output=true

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /