Skip to content

Commit bb2070f

Browse files
committed
页面和静态资源路径修改,使路径更简洁统一
1 parent 0668b44 commit bb2070f

4 files changed

Lines changed: 19 additions & 14 deletions

File tree

src/main/java/org/eh/core/common/Constants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public class Constants {
2020

2121
/* 配置信息 */
2222
public static String PACKAGE_PREFIX = "org.eh.web."; // 包前缀
23-
public static String VIEW_BASE_PATH = "org/eh/web/view/"; // view包路径
23+
public static String VIEW_BASE_PATH = ""; // 路径
24+
public static String STATIC_RESOURCE_PATH = ""; // 静态文件路径
2425

2526
public static Map<String, String> UrlClassMap = new HashMap<String, String>(); // url与class映射
2627
public static Map<String, String> OTHER_CONFIG_INFO = new HashMap<String, String>(); // 其他配置信息

src/main/java/org/eh/core/web/view/ViewHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private String analysisViewPath(String viewPath) {
6969
}
7070

7171
private String analysisVelocityViewPath(String viewPath) {
72-
String path = Constants.VIEW_BASE_PATH + viewPath + ".vm";
72+
String path = Constants.VIEW_BASE_PATH + "/" + viewPath + ".vm";
7373
return path;
7474
}
7575
}

src/main/resources/web.properties

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#包前缀
22
PACKAGE_PREFIX=org.eh.web
33

4-
#view页面根路径
5-
VIEW_BASE_PATH=org/eh/web/view/
4+
#模板页面根路径(相对classes文件夹,项目src/main/view下)
5+
VIEW_BASE_PATH=page
66

7-
#controller包路径,配置后可通过annocation直接配置
8-
controller.package=org.eh.web.controller
7+
#静态资源路劲(相对classes文件夹,项目src/main/view下)
8+
STATIC_RESOURCE_PATH=static
99

1010
#端口
1111
httpserver.port=8888
1212

13+
#controller包路径,配置后可通过annocation直接配置
14+
controller.package=com.gj.web.controller
15+
1316
#url与controller类对应关系
14-
url/test/list=org.eh.web.controller.TestController
15-
url/test/other=org.eh.web.controller.TestController
17+
#url/list=com.gj.web.controller.MyController

target/classes/web.properties

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#包前缀
22
PACKAGE_PREFIX=org.eh.web
33

4-
#view页面根路径
5-
VIEW_BASE_PATH=org/eh/web/view/
4+
#模板页面根路径(相对classes文件夹,项目src/main/view下)
5+
VIEW_BASE_PATH=page
66

7-
#controller包路径,配置后可通过annocation直接配置
8-
controller.package=org.eh.web.controller
7+
#静态资源路劲(相对classes文件夹,项目src/main/view下)
8+
STATIC_RESOURCE_PATH=static
99

1010
#端口
1111
httpserver.port=8888
1212

13+
#controller包路径,配置后可通过annocation直接配置
14+
controller.package=com.gj.web.controller
15+
1316
#url与controller类对应关系
14-
url/test/list=org.eh.web.controller.TestController
15-
url/test/other=org.eh.web.controller.TestController
17+
#url/list=com.gj.web.controller.MyController

0 commit comments

Comments
 (0)