title: url encoding in java?
body: <p>I want to know that what is <em>url encoding</em>.
  I have 2 jsp pages and one servlet.
  When I run the application the url displayed is :</p>
  
  <p><code>http://localhost:8080/myproject/index.jsp</code></p>
  
  <p>where</p>
  
  <p><strong>index.jsp :</strong></p>
  
  <pre><code>&lt;form action="Myservlet" method="post"&gt;
      &lt;input type="text" name="mytext" id="mytext"/&gt;
      &lt;input type="submit" value="submit"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>after the submit button is clicked the URL displayed is :</p>
  
  <p><code>http://localhost:8080/myproject/Myservlet</code></p>
  
  <p><strong>What is the meaning of URL encoding? How can I encode url?</strong></p>
  
  <p>From <code>index.jsp</code> goes to <code>Myservlet</code> then to <code>result.jsp</code></p>
  
  <p><strong>Myservet#doPost</strong> // Do I need to do URL encoding here? If yes how ?</p>
  
  <pre><code>  fetching data from db.......
    ....................
    String nextJSP = "/result.jsp";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
    dispatcher.forward(request,response);
  </code></pre>
  
  <p><strong>result.jsp</strong></p>
  
  <p><code>displays data here</code></p>