我怎么知道调用servlet的网页? [英] How can I know the webpage that calls a servlet?

查看:71
本文介绍了我怎么知道调用servlet的网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有一个表格的网页,当它提交时,运行一个servlet。在那个servlet中,我需要知道调用servlet的网页。我该怎么办?



我使用的是Java 8.



谢谢



我尝试了什么:



我尝试了几种方法HttpServletRequest,如getQueryString,getServletPath,getServletInfo,getContextPath,getRequestURI,getRequestURL,但这些都不返回网页。他们中的大多数都返回servlet的名称,但不会返回调用它的网页名称。

解决方案

 request.getHeader(  referer); 


Hello

I have a webpage with a forms that when it submits, runs a servlet. In that servlet I need to know the webpage who calls the servlet. How can I do?

I´m using Java 8.

Thanks

What I have tried:

I try with several methods of HttpServletRequest, as getQueryString, getServletPath, getServletInfo, getContextPath, getRequestURI, getRequestURL, but neither of those returns the webpage. Most of them returns the name of the servlet, but not the webpage´s name that calls it.

解决方案

request.getHeader("referer");


这篇关于我怎么知道调用servlet的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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