【发布时间】:2011-03-27 15:04:01
【问题描述】:
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=''。如果“out.println();”,上面的代码在 JSP 中有效已删除,但如您所见,我需要比较 category.equals("seasonal decorations") 并仅在需要时在特定代码上运行,所以如果有人知道如何克服这个特定问题,请帮助我。
请记住,由于我使用的是条形码扫描仪,因此我无法使用 sumbit 按钮提交。
【问题讨论】:
-
请联系ask good questions。除其他外,这意味着格式化您的代码,进行快速拼写检查,使用正确的语法和完整的句子,而不是使用“sms-speak”,不使用全大写(这相当于大喊大叫) - 这些都是你的标志粗鲁无礼,不关心付出任何努力 - 那么为什么其他人要努力帮助你呢?
标签: sql-server jsp webforms form-submit