title: Display html form on same jsp page
body: <p>In image mentioned, if I click "add new button" then my html form should be on same page(gold.jsp page).but it goes another jsp page(additem.jsp as mentioned in javascript code here), how can I display it on gold.jsp page itself, it goes additem.jsp here.
  <a href="https://i.stack.imgur.com/keLAq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/keLAq.png" alt="enter image description here"></a></p>
  
  <p>This is my gold.jsp page coding, here I used javascript inside jsp.</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert gold&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;style type = "text/css"&gt;
  body
  {
  background-color:black;
  }
  p
  {
  color:yellow;
  }
  
  button
  {
  background-color:yellow;
  
  }
  
  
  p
  {
  color:yellow;
  }
  &lt;/style&gt;
  &lt;script type ="text/javascript"&gt;
  function onsubmitform()
  {
      if(document.pressed == "insert")
          {
  
          document.myform.action = "additem.jsp";
  
  
          }
  
      else if(document.pressed == "addstock")
      {
  
      document.myform.action = "display.jsp";
      }
  
      }
  
  
  
  
  
  
  
  
  
  &lt;/script&gt;
  &lt;body&gt;
  &lt;hr/&gt;
  
  &lt;img src = "C:\Users\ms trapti\workspace\jewellery\WebContent\images\images2.jpg"   width = "50px" height = "50px" vspace = "5px"/&gt;
  &lt;center&gt;&lt;img src = "E:\jewellery 18-dec\18decjewry\jewellerynew\WebContent\images\untitled2.png" alt = "gold" width = "60px" height = "60px"&gt;&lt;/img&gt;&lt;/center&gt;
  &lt;p&gt;&lt;i&gt;Trapti jewellery&lt;/i&gt;&lt;/p&gt;
  &lt;center&gt;&lt;p&gt; Gold Management System&lt;/p&gt;&lt;/center&gt;&lt;br/&gt;
  
  &lt;div style = "position:fixed;  left: 300px; bottom: 130px;" &gt;
  &lt;p&gt;Tray No:&lt;select&gt;
  &lt;option value &gt;&lt;/option&gt;
  &lt;/p&gt;
  &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;table&gt;
  
  &lt;form name = "myform" onsubmit = "return onsubmitform();"&gt;
  &lt;button type = "submit" name = "operation" onclick = "document.pressed = this.value" value = "addstock"&gt;Add new Stock&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;
  
  
  
  &lt;button type = "submit" name = "operation" onclick = "document.pressed = this.value" value = "insert"&gt;Add new Item&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;
  &lt;button type = "submit" name = "operation" onclick = "document.pressed = this.value" value = "insert"&gt;Delete Item&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;
  
  
  
  &lt;button type = "submit" name = "operation" onclick = "document.pressed = this.value" value = "update"&gt;Purchase&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;
  &lt;button type = "submit"&gt;Sales&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;/form&gt;
  &lt;/table&gt;
  
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>