title: Java : Redirect from Servlet leads to a blank page
body: <p>I am trying to redirect to an HTML page from a servlet. For debugging, I have minimal amount of code in my servlet, HTML page and in web.xml</p>
  
  <p>I can load HTML page fine in browser without the servlet. But when I try to redirect to the same page from a servlet, only a blank page is rendered. No error is displayed.
  Following is the relevant code.</p>
  
  <blockquote>
    <p>web.xml</p>
  </blockquote>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5"&gt;
      &lt;display-name&gt;name&lt;/display-name&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;net.semandex.salsa.webapp.SalsaWebApp&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;description&gt;
          &lt;/description&gt;
          &lt;display-name&gt;SalsaValidationServlet&lt;/display-name&gt;
          &lt;servlet-name&gt;SalsaValidationServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;net.semandex.salsa.validationServlets.SalsaValidationServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;SalsaValidationServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;session-config&gt;
          &lt;session-timeout&gt;20&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <blockquote>
    <p>Servlet</p>
  </blockquote>
  
  <pre><code>import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  public class SalsaValidationServlet extends HttpServlet {
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String path = request.getPathInfo();
          if(path == null) return;
          String []p = path.split("/");
          if( !path.endsWith("licenseValidation.html") )
              //request.getRequestDispatcher("/auth/licenseValidation.html").forward(request, response);
              response.sendRedirect( request.getContextPath() + "/auth/licenseValidation.html" );
      }
  
      @Override
      protected void doPost(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, IOException {
          doGet(req, resp);
      }
  }
  </code></pre>
  
  <blockquote>
    <p>HTML Page - licenseValidation.html</p>
  </blockquote>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;License upload page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form&gt;
          &lt;input type="text" name="name"/&gt;&lt;br&gt;        
          &lt;input type="text" name="group"/&gt;
          &lt;input type="text" name="pass"/&gt;
          &lt;input type="submit" value="submit"&gt;            
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>Why is this code loading a blank page and not an HTML page?
  Redirection does happen but to a blank page. Status code for the new URL in browser is 200 but the response is empty in debugger.</p>
  
  <blockquote>
    <p><strong>Edit:</strong></p>
  </blockquote>
  
  <p>The problem was "/*" URL pattern as stated by BalusC. Found more useful information in his another answer.
  <a href="https://stackoverflow.com/questions/4140448/difference-between-and-in-servlet-mapping-url-pattern">Difference between / and /* in servlet mapping url pattern</a></p>