天天看點

WebRoot目錄和WebContent目錄的差別

摘自https://zhidao.baidu.com/question/1897919580100474700.html

1、在Eclipse中生成項目是WebContent目錄,而在myeclipse中生成的是webroot。

2、如果把MyEclipse的項目導入到Eclipse中,如果要部署項目到Tomcat中需要做以下修改:

a.右鍵點選項目--屬性--Add

添加WebRoot目錄,删除WebContent

WebRoot目錄和WebContent目錄的差別

b.建立webroot目錄

WebRoot目錄和WebContent目錄的差別

3、二者的目錄不同

WebContent目錄:

WebRoot目錄和WebContent目錄的差別

WebRoot目錄:

WebRoot目錄和WebContent目錄的差別

自己用的是EclipseEE,導入其他項目的時候總是WebRoot目錄,而自己建立的項目則都是WebContent,導緻在使用SpringMVC時總是搞混靜态檔案如js,css,html等檔案應該存放的位置

現在看來,好多網上的說法都是預設使用的是WebRoot目錄的。

記錄一下WebContent時的配置

WebRoot目錄和WebContent目錄的差別

這樣在通路靜态資源如html時,輸入http://localhost:8080/project_name/page/index.html

就可以通路project_name項目的WebContent/page/index.html這個檔案了

而WebRoot的應該也隻是做了目錄上的變更。

繼續閱讀