title: Remain in same page even after submitting jsp form
body: <p>I'm using a jsp to post data to a servlet, but after posting the data i want to stay back insame jsp. 
  Briefly: 
  1) I have a jsp here with 2 textboxes. i use a javascript to copy data from one to another on a button click. 
  2) I use the same button to post data to a database. 
  3) I want both the actions to be done at a time and should not go to the third jsp(servlet post result), but , should go to another jsp i use. </p>
  
  <p>i'm able to handle these 2 things seperately but together i'm unable to do it. the data gets updated in database and shows a new line in the first text(that's my fault i'm using the redirect way) or moves the data from first textbox to another and doesn't do the data posting. please help me about doing it. below is the code piece i used to do it. </p>
  
  <p>java script to copy data and post data are: </p>
  
  <pre><code>function move(){  
  
  document.getElementById('tgt1').value = document.getElementById('Allocation').value;  
  document.getElementById('Allocation').value="";  
  document.getElementById("Send").disabled=true;  
  
  }
  function invoke(but)  
    {  
     if(but==0)   
      {  
          document.myform.action="Alloc_Insert.do";  
      }  
  </code></pre>
  
  <p>the methods for the button are declared as follows: </p>
  
  <pre><code>&lt;table&gt;&lt;tr&gt;&lt;center&gt;&lt;td&gt;&lt;input type="Submit" value="Allocate" id="Send"     onClick="invoke(0);move();" style="width:150px" style="font-size:100%"/&gt;&lt;/td&gt;&lt;/center&gt;&lt;/tr&gt;    &lt;/table&gt; 
  </code></pre>
  
  <p>and the servlet code i used are as follows. </p>
  
  <pre><code>ResultSet rs=null;  
          String Add=request.getParameter("tgt1");  
          String user=(String) session.getAttribute("myusername");  
          Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();Date d1 = new Date();    
          String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);   
          Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");  
          PreparedStatement ps=con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");  
          con.setAutoCommit(true);  
          int i=ps.executeUpdate();  
          if(i==1)  
                             {  
               String redirectURL= "Update_Counts.jsp";  
              response.sendRedirect(redirectURL);  
                          }  
                     else{  
  
              out.print("retry");  
                    }  
  </code></pre>
  
  <p>i want to post the data aswell as be on the same with the textbox value copied into second textbox, as i would be using it for my further referrence. </p>
  
  <p>Thanks </p>