如何在JSP或JSTL中获取页面名称? [英] How to get page name in JSP or JSTL?

查看:174
本文介绍了如何在JSP或JSTL中获取页面名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用JSP或JSTL获得当前页面名称(类似"myPage").我怎样才能做到这一点?

I want to get current page name (something like "myPage") using JSP or JSTL. How can I achieve this?

推荐答案

您可以通过

You can get it by HttpServletRequest#getServletPath().

${pageContext.request.servletPath}

您可以使用 JSTL函数 taglib以便在必要时提取扩展名.

You can use the JSTL functions taglib to extract the extension whenever necessary.

这篇关于如何在JSP或JSTL中获取页面名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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