2013-03-19 170 views
4

我創建了兩個使用我的web.xml文件中定義的url-pattern時運行的servlet。 例如運行的第一個我在瀏覽器中鍵入以下內容:在IntelliJ Idea 12項目中更改Servlet的根上下文

http://localhost:8080/XmlServletPath 

我想找到一種方式來運行,從一個不同的根上下文這些小服務程序,例如:

http://localhost:8080/SimpleServletProject/XmlServletPath 

當我嘗試了上面的網址現在我收到以下錯誤:

HTTP Status 404 - /SimpleServletProject/XmlServletPath 

type Status report 
message /SimpleServletProject/XmlServletPath 
description The requested resource is not available. 

PS:我使用Tomcat 7.0.35

回答

12

應用程序上下文可以在Tomcat運行/調試配置的部署選項卡中指定:

context

+0

我做到了,現在沒有什麼工作在all.Neither任何more.Nothing我的索引。 jsp頁面或我的servlets。 – skiabox 2013-03-19 22:21:16

+0

請壓縮並分享您的示例項目以進行復制。它絕對適合我。 – CrazyCoder 2013-03-19 22:27:35

+0

好吧,這裏是:https://docs.google.com/file/d/0BxjdiwIZVU9OZEs0OHlKbVFScWc/edit?usp=sharing – skiabox 2013-03-19 22:40:38