title: how to submit a form without using a submit button in servlet
body: <pre><code>if(Category.equals("Seasonal Decorations")){
      out.println("&lt;form name='adddeco' id='adddeco' method='post'&gt;");
      out.println("&lt;input type=hidden name=cater value=decos&gt;" +
                  "&lt;table border=0 colspan=5 &gt;" +
                  "&lt;tr&gt;&lt;th&gt;Name &amp; Description of DECORATION &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_itemname width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;Product ID                  &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_PID width=30&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/table&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;Provider                    &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_provide width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;AVAILIBILTY&lt;/th&gt;&lt;th&gt;&lt;select name=DECO_AVAIL&gt;"+
                  "&lt;option&gt;UNAVAILABLE&lt;/option&gt;" +
                  "&lt;option&gt;AVAILABLE&lt;/option&gt;&lt;/select&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;No.of DECORATION                 &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_qnty width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;Shelf NO                    &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_shelfno width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;Original Price              &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_orgprice width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println("&lt;tr&gt;&lt;th&gt;Selling Price               &lt;/th&gt;&lt;th&gt;&lt;input type=text name=deco_sellprice width=30&gt;&lt;/th&gt;&lt;/tr&gt;");
      out.println(" &lt;input type=button value=add onclick='$(#adddeco).attr(action,additem1);$(#adddeco).submit();'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type=reset value=clear&gt;" +
                  "&lt;/form&gt;");
  </code></pre>
  
  <p>The above is my code in a Servlet in order to enter a value to a DB but the problem is that I'm not able to sumbit this form to the next page as you can see I'm not using a "submit" button instead I'm using an event onclick=''. The above code works in JSP if the "out.println();" is removed but as you can see that I need to compare <code>category.equals("seasonal decorations")</code> and run on the specific code only when required so if anyone who knows about how to overcome this particular problem please help me out.</p>
  
  <p>And please keep in mind that I cannot use a sumbit button to submit as I'm using a barcode scanner.</p>