在JSF 1.2 bean中获取浏览器URL

时间:2014-06-04 02:54:48

标签: jsf

我在我的网站上使用Tuckey URL重写器,因此(例如)URL www.test.com/faces/dynamicForm.jsp对用户显示为www.test.com/a/b/c/form。 HTML

在我的bean中,如何访问用户在浏览器中看到的URL,在这种情况下:www.test.com/a/b/c/form.html

1 个答案:

答案 0 :(得分:0)

您可以从HttpServletRequest获取javax.faces.context.ExternalContext

您可以从中调用getRequestURL方法。

HttpServletRequest request = (
HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String url = request.getRequestURL()
相关问题