Jsp的网址映射 [英] Url Mapping For Jsp

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

问题描述

我想为我的网页做一个映射.我在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的网址映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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