title: How to encrypt Url in Servlet?Ho
body: <p>I want to encrypt my Url in servlet .Please check my code below</p>
  
  <p><strong>TestServlet</strong></p>
  
  <pre><code>public class TestServlet extends HttpServlet {
      public void doGet(HttpServletRequest request,HttpServletResponse response)
          throws IOException {
        String url"Test2?name=bhanuprasd";
        response.sendRedirect(url);
      }
  }
  </code></pre>
  
  <p><strong>Test2</strong></p>
  
  <pre><code>public class Test2 extends HttpServlet {
      public void doGet(HttpServletRequest request,HttpServletResponse response)
          throws IOException {
          System.out.println("calling my first servlet");
          String name = request.getParameter("name");
          response.getWriter().print("hello"+name);
      }
  }
  </code></pre>
  
  <p>when my request  redirect to my page in browser it's displayed name like this</p>
  
  <pre><code>**http://MyServer/Test/Test2?name=bhanuprasd**
  </code></pre>
  
  <p>I don't want to show the name in browser How can I do this. I try this way but not working </p>
  
  <pre><code>String url=java.net.URLEncoder.encode("Test2?name='bhanuprasd'");
  String url1 =response.encodeRedirectUrl("Test2?name='bhanuprasd'");
  </code></pre>