更改IntelliJ IDEA项目中servlet的根上下文 [英] Change root context for a servlet in an IntelliJ IDEA project

查看:684
本文介绍了更改IntelliJ IDEA项目中servlet的根上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个servlet,当我使用我的web.xml文件中定义的url-pattern时运行。

I have created two servlets that run when I use their url-pattern that is defined in my web.xml file.

例如,运行第一个我在浏览器中输入以下内容:

For example, to run the first one I type the following in my browser:

http://localhost:8080/XmlServletPath

我想找到一种从不同的根上下文运行这些servlet的方法,例如:

I want to find a way to run these servlets from a different root context, for example:

http://localhost:8080/SimpleServletProject/XmlServletPath

当我尝试上面的URL时,我收到以下错误:

When I try the above URL now I am getting the following error:

HTTP Status 404 - /SimpleServletProject/XmlServletPath

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

PS:我使用的是Tomcat 7.0.35。

PS: I am using Tomcat 7.0.35.

推荐答案

应用程序上下文可以在Tomcat运行/调试配置的部署选项卡中指定:

Application context can be specified in the Deployment tab of the Tomcat Run/Debug configuration:

这篇关于更改IntelliJ IDEA项目中servlet的根上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆