title: Using onclick event to submit 2 parameters into a the same servlet
body: <p>I'm trying to use a submit button to pass 2  parameters, <code>userId</code> and <code>friendId</code>, using jsp into the same servlet. I am able to obtain <code>friendId</code>, however, I am not able to obtain the <code>userId</code>.</p>
  
  <pre><code>function anotherPageServlet(servletName) {
  
      document.forms[0].method = "post";
      document.forms[0].action = servletName;
      document.forms[0].submit();
  }
  
  function anotherPageServlet1(servletName) {
  
      document.forms[0].method = "post";
      document.forms[0].action = servletName;
      document.forms[0].submit();
  }
  
  &lt;input style="color:#3333ff" 
         type="submit" 
         class="rsubmit" 
         value="&lt;%= retrieving.getDisplayname()%&gt; :" 
         onclick="anotherPageServlet('ViewingFriendServlet?stringParameter=&lt;%= session.getAttribute("userId") %&gt;'),
  anotherPageServlet1('ViewingFriendServlet?stringParameter=&lt;%=retrieving.getoID() %&gt;')"
  &gt;
  </code></pre>