2013-03-19 163 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