Jsp 的 URL 映射 [英] Url Mapping For Jsp

查看:24
本文介绍了Jsp 的 URL 映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的网页做一个映射.一种类似于我在 web.XML 中完成的 Servlet 映射的映射,不一定是相同的代码或过程,但结果相同.换句话说,我的目标是隐藏我的网页的部署.可能吗?

I would like to do a mapping for my web pages. A sort of mapping like Servlet Mapping that i've done in the web.XML, not necessarily the same code or procediment but the same result. In other words my goal is to hide the deployment of my web pages. Is it possible?

推荐答案

您可以像处理 servlet 一样执行此操作.唯一的区别是您必须使用 jsp-file 而不是 servlet-class 来声明您的 servlet:

You can do it the same way as for servlets. The only difference is that you must use jsp-file instead of servlet-class to declare your servlet:

<servlet>
    <servlet-name>Hello</servlet-name>
    <jsp-file>hello.jsp</jsp-file>
</servlet>

<servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/hi</url-pattern>
</servlet-mapping>

这篇关于Jsp 的 URL 映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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