在eclipse裏新建了一個web項目,加了一個test1.jsp。
新建了一個tomate的server,綁定到項目裏。Run-As->Run On Server, 網頁中顯示The requested resource is not available錯誤。
解決辦法:
1.檢查jsp的目錄是否正確,要放到WebContent下面,不能在其他目錄下,很多人誤操作會放到WEB-INF下面。
2.檢查server項目的web.xml中,
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>//默認是false,此處要改成true
</init-param>
3.檢查訪問的URL是否拼寫正確。
4.檢查jsp文件的名字是不是在項目的web.xml中出現了,(這個在其他人的解決辦法中看到,貌似名字不匹配也可以訪問,作爲參考)
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
如果爲出現,可以重命名文件爲index.jsp或者修改web.xml文件。