if(Category.equals("Seasonal Decorations")){
out.println("<form name='adddeco' id='adddeco' method='post'>");
out.println("<input type=hidden name=cater value=decos>" +
"<table border=0 colspan=5 >" +
"<tr><th>Name & Description of DECORATION </th><th><input type=text name=deco_itemname width=30></th></tr>");
out.println("<tr><th>Product ID </th><th><input type=text name=deco_PID width=30></th></tr></table>");
out.println("<tr><th>Provider </th><th><input type=text name=deco_provide width=30></th></tr>");
out.println("<tr><th>AVAILIBILTY</th><th><select name=DECO_AVAIL>"+
"<option>UNAVAILABLE</option>" +
"<option>AVAILABLE</option></select></th></tr>");
out.println("<tr><th>No.of DECORATION </th><th><input type=text name=deco_qnty width=30></th></tr>");
out.println("<tr><th>Shelf NO </th><th><input type=text name=deco_shelfno width=30></th></tr>");
out.println("<tr><th>Original Price </th><th><input type=text name=deco_orgprice width=30></th></tr>");
out.println("<tr><th>Selling Price </th><th><input type=text name=deco_sellprice width=30></th></tr>");
out.println(" <input type=button value=add onclick='$(#adddeco).attr(action,additem1);$(#adddeco).submit();'> <input type=reset value=clear>" +
"</form>");
以上是我在Servlet中的代码,以便为数据库输入值,但问题是我无法将此表单下一页,你可以看到我没有使用“提交”按钮,而是使用事件onclick =''。上面的代码在JSP中工作,如果“out.println();”已被删除,但您可以看到我需要比较category.equals("seasonal decorations")
并仅在需要时运行特定代码,因此如果有人知道如何解决此特定问题,请帮助我。如何在不使用servlet中的提交按钮的情况下提交表单
请注意,由于我使用的是条码扫描器,因此无法使用sumbit按钮进行提交。
请努力[问好问题](http://catb.org/esr/faqs/smart-questions.html)。除此之外,这意味着格式化你的代码,做一个快速的拼写检查,使用正确的语法和完整的句子,不使用'sms-speak',不使用全部大写字母(这等于喊) - 这些都是你的标志没有足够的关心和努力 - 为什么其他人应该努力帮助你? – 2011-03-27 15:33:30