最近在學Struts2框架部分的內容,但是eclipse中配置tomcat遇到了很大的問題,當辛辛苦苦的配置完了之后,竟讓連小貓的首頁都不能訪問,http://localhost:8080/輸入了之后提示HTTP Status 404
type Status report message /sOffice2/ description The requested resource is not available.
於是乎,心酸的查找bug開始了,
(1)首先xxx.jsp文件必須放在WebContent目錄下面,而不能放在WEB_INF目錄之下
(2)第二個問題是在Stack overflow上面找到了答案:
1:Click on Window > Show view > Server or right click on the server in "Servers" view, select "Properties". 2:In the "General" panel, click on the "Switch Location" button. 3:The "Location: [workspace metadata]" should replace by something else. 4:Open the Overview screen for the server by double clicking it.In the Server locations tab , select "Use Tomcat location".(此時有可能界面為灰色) 5:Save the configurations and restart the Server.

方法里面說將tomcat換成自己的安裝的tomcat,但是界面是灰色的,怎么辦呢?原來是因為我們將項目部署到了tomcat上面,因此需要移除項目,在項目上面右擊——Remove
此時Server locations界面即可用,"Deploy Path"后面的值默認是"wtpwebapps",把它改成"webapps",(這里面改成webapps也就是找到自己安裝tomcat的目錄,只不過換了名字之后軟件可以自己定位到目錄)
到此,問題就搞定了,入托上面兩個方法我全部都沒有用。
(3)即使eclipse中的tomcat服務器打開了,也沒有,必須把外部的tomcat服務器打開。
c
