title: How to call a URL with params and get back response in servlet?
body: <p>I have a situation where a intermediate servlet needs to be introduced which will handle requests from existing project and redirect the manipulated response to either existing project or the new one. This servlet will act as an <strong>interface to login</strong> into the new project from some other application.</p>
  
  <p>So currently I use the following code to get back response in jsp as an xml.</p>
  
  <pre><code>var jqxhr =$.post("http://abhishek:15070/abc/login.action",
                    { emailaddress:   "ars@gmail.com",
                      projectid:      "123" },
                        function(xml)
                        {
                              if($(xml).find('isSuccess').text()=="true")
                              {
                                  sessiontoken=$(xml).find('sessiontoken').text();
  
                                  setCookie("abcsessionid", sessiontoken , 1);
                                  setCookie("abcusername",e_add,1);
                              }
                        }
                  )
                  .error(function() {
                      if(jqxhr.responseText == 'INVALID_SESSION') {
                          alert("Your Session has been timed out");
                          window.location.replace("http://abhishek:15070/abc/index.html"); 
                      }else  {
                          alert( jqxhr.responseText);
                      }
                   });
  </code></pre>
  
  <p>xml content</p>
  
  <pre><code>&lt;Response&gt;
    &lt;sessiontoken&gt;334465683124&lt;/sessiontoken&gt;
    &lt;isSuccess&gt;true&lt;/isSuccess&gt;
  &lt;/Response&gt;
  </code></pre>
  
  <p>but now I want the same thing to be done using servlet, is it possible? </p>
  
  <pre><code>String emailid=(String) request.getParameter("emailaddress");
  String projectid=(String) request.getParameter("projectid");
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I just came up with something. </p>
  
  <p>Is it possible to return back a html page with form (from servlet), whose <code>on body load</code> it will submit a form and on submission of this form it will receive the response <strong>xml</strong> which will get processed.</p>