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