title: How to forward the requestdispatcher to a remote URL
body: <p>Am having a HTML page <code>http://www.mywebapp.com/sample.html</code> which is used from remote server. am passing the HTML URL as hidden form like this in the same HTML form,</p>
  
  <pre><code>&lt;form action="/myservlet?userid=12345" method="post" enctype="multipart/form-data"&gt;
  &lt;input type="file" name="file"&gt;
  &lt;input type="submit" value="Submit"&gt;
  &lt;input type="hidden" name="url" value="http://www.mywebapp.com/sample.html"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In my servlet i got the hidden URL <code>http://www.mywebapp.com/sample.html</code> and stored it as 
  <code>String fieldValue = http://www.mywebapp.com/sample.html</code></p>
  
  <p>Now When i try <code>RequestDispatcher</code> and forward the page to the hidden URL like this,</p>
  
  <pre><code>RequestDispatcher rd = req.getRequestDispatcher(fieldValue);
  rd.forward(req, resp);
  </code></pre>
  
  <p>am getting <code>ERROR 404</code>. </p>
  
  <p>Can anyone suggest me an idea to solve this. </p>
  
  <p><strong>EDITED</strong></p>
  
  <p>What i exactly want to do is, From a Remote Server a HTML page will request to my REST Web services. The response of the web service will be in JSON output. Now i want to send this JSON Response to the requested HTML form(i.e. to the Remote Server HTML page) </p>
  
  <p>Can anyone suggest an idea to solve this.
  Your help will be appreciated.</p>