2012-09-24 27 views
2

我正嘗試在Eclipse EE Juno中編寫一個簡單的Java EE應用程序。這裏是我的項目的文件層次:Tomcat上的「Servlet當前不可用」錯誤

project file hierarchy

的index.jsp:

<jsp:forward page="/departments.do"/> 

的web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> 
    <display-name>UniBudget</display-name> 
    <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> 
    <servlet> 
    <servlet-name>Do</servlet-name> 
    <servlet-class>control.Controller</servlet-class> 
    </servlet> 
    <servlet-mapping> 
    <servlet-name>Do</servlet-name> 
    <url-pattern>*.do</url-pattern> 
    </servlet-mapping> 
</web-app> 

的錯誤,我得到:

HTTP Status 503 - Servlet Do is currently unavailable 

和q問題:爲什麼會發生這種情況,我該如何解決?

+2

在您的url模式中添加正斜槓。 '/*。do' – HashimR

回答

3

請在您的網址格式中添加正斜槓。

<url-pattern>/*.do</url-pattern>

+0

這麼簡單的事情......但現在去'http:// localhost:8080/budget /'後我得到了'所請求的資源(/ budget /)是無法使用。 '。上下文根被設置爲「預算」。更不用說'/ *。do'地址 - 同樣的事情。 – alex

+0

當你點擊jsp頁面?你爲什麼不先做一個簡單的html頁面。放在WebContent中並通過'http:// localhost:8080/budget/myHtmlPage.html'來訪問它,以檢查應用程序是否正確部署並且上下文根是否正確。 – HashimR

+0

你是對的 - 顯然它不工作。我在'index.jsp'中放了一些「hello world」,它不會運行。但我完全不知道爲什麼 - 它看起來像正確部署... – alex

相關問題