Servlet web.xml servlet-mapping [英] Servlet web.xml servlet-mapping

查看:38
本文介绍了Servlet web.xml servlet-mapping的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 web.xml 我有以下代码

On my web.xml I have the following code

<servlet>
    <servlet-name>controller</servlet-name>
    <servlet-class>ControllerServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>


<servlet-mapping>
    <servlet-name>controller</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>controller</servlet-name>
    <url-pattern>/url/*</url-pattern>
</servlet-mapping>

要进入 servlet,网址必须是:htp://ee:8080/ER/index.do 或 htp://ee:8080/ER/url/888.我想通过类似 htp://ee:8080/94353 的路线进入.

To enter into the servlet the url has to be like : htp://ee:8080/ER/index.do or htp://ee:8080/ER/url/888. I want to get enter by a route like htp://ee:8080/94353.

我尝试了很多可能性,但我找不到正确的一种.

I've tried a lot of possibilities but I can't find the correct one.

谢谢!

推荐答案

我认为 URL 中不能省略应用程序名称因为在 URL 中需要定义服务器的 IP 地址和端口号,在服务器中部署了很多应用程序.您需要告诉服务器您要访问哪个应用程序

I think you can't omit the application name from URL because in the URL you need to define the IP address of the server and the port number, in server there are a lot of applications are deployed in it. you need to tell server which application you want to access

这篇关于Servlet web.xml servlet-mapping的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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