2016-07-08 29 views
0

我有一个Maven的Web应用程序,并形式的验证重定向,但在成功登录它消除了我的URL参数debug的Java servlet的查询字符串去除了

http://localhost:8080/TestProject/?debug

更改 - >http://localhost:8080/TestProject/

我在index.html页面中使用该参数表示某些逻辑

不确定我做了什么来做到这一点

这里是我的web.xml

<web-app version="3.0" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 
<display-name>Servlet 3.0 Web Application</display-name> 


<welcome-file-list> 
<welcome-file>test/index.html</welcome-file> 
</welcome-file-list> 
    <display-name>Archetype Created Web Application</display-name> 

<filter> 
    <filter-name>AuthFilter</filter-name> 
<filter-class>com.test.AuthClass</filter-class> 
</filter> 
<filter-mapping> 
<filter-name>AuthClass</filter-name> 
<url-pattern>/*</url-pattern> 
<dispatcher>FORWARD</dispatcher> 
<dispatcher>REQUEST</dispatcher> 
</filter-mapping> 

</web-app> 

让我知道,如果你需要查看更多

+0

重新定向在哪里完成?如果它是从你的AuthClass完成的,那么你将不得不再次添加该请求参数。这是预期的行为。只要您重定向或转发,所有请求参数都将丢失。 – Ankit

回答

0

我想你使用的网址在您的过滤代码重写。 过滤器的过滤器方法有请求和响应对象。请检查您的过滤器方法

+0

感谢您的回应它是'httpResponse.sendRedirect(requestedURL)';' –

+0

String requestedURL = request.getParameter(“requestURL”); –

+0

我试过这样的东西,但它回来为空 - 'string requestQueryString =(httpRequest.getQueryString()!= null?“?”+ httpRequest.getQueryString():“”); doFilter方法有'ServletRequest请求'btw \t \t' –