年后的工作不是那么的忙,最近也开始思考自己以后的路该怎么走,在迷茫的时候,还是坚持学习点儿东西吧。
接着之前的JSP,这次是要尝试着用request.getParameter(ParameterName)和request.getPatameterValues(parameterName)来获取客户端HTML页面提交过来的参数,并将其显示出来。具体代码如下:
HTML页面:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 5 <title>商品信息输入</title> 6 <style type="text/css"> 7 <!-- 8 .STYLE1 {color: #FF0000} 9 --> 10 </style> 11 </head> 12 13 <body> 14 <form action="product_entry.jsp" method="get" name="form1" id="form1"> 15 <br /> 16 <table width="494" border="1" align="center"> 17 <tr> 18 <th width="106" height="41" scope="row">商品编号</th> 19 <td width="372"><label> 20 <input name="PRODUCTID" type="text" id="productId" /> 21 </label> 22 <span class="STYLE1">*</span> (* 里面为必须输入内容) </td> 23 </tr> 24 <tr> 25 <th height="33" scope="row">条码</th> 26 <td><input name="barcode" type="text" id="barcode" /></td> 27 </tr> 28 <tr> 29 <th height="33" scope="row">商品名称</th> 30 <td><input name="productName" type="text" id="productName" /> 31 <span class="STYLE1">* </span></td> 32 </tr> 33 <tr> 34 <th height="35" scope="row">商品类型</th> 35 <td><label> 36 <select name="productType" size="6" id="productType"> 37 <option value="小食品" selected="selected">小食品</option> 38 <option value="饮料">饮料</option> 39 <option value="乳制品">乳制品</option> 40 <option value="烟酒">烟酒</option> 41 <option value="洗化用品">洗化用品</option> 42 <option value="其他">其他</option> 43 </select> 44 </label></td> 45 </tr> 46 <tr> 47 <th height="43" scope="row">供应商</th> 48 <td><label> 49 <select name="vendor" id="vendor"> 50 <option value="伊利公司">伊利公司</option> 51 <option value="蒙牛公司">蒙牛公司</option> 52 <option value="圣元奶粉厂">圣元奶粉厂</option> 53 <option value="三鹿乳品厂">三鹿乳品厂</option> 54 <option value="光明乳业">光明乳业</option> 55 <option value="雅培奶粉公司">雅培奶粉公司</option> 56 <option value="其他" selected="selected">其他</option> 57 </select> 58 </label></td> 59 </tr> 60 <tr> 61 <th height="36" scope="row">进价</th> 62 <td><label> 63 <input name="price" type="text" id="price" /> 64 (请输入数字)</label></td> 65 </tr> 66 <tr> 67 <th height="32" scope="row">包装类型</th> 68 <td><input name="package_type" type="radio" id="radiobutton" value="个" checked="checked" /> 69 <label for="radiobutton"></label> 70 <label for="checkbox">个 71 <input type="radio" name="package_type" value="只" id="radio" /> 72 只 73 <input type="radio" name="package_type" value="箱" id="radio2" /> 74 箱 75 <input type="radio" name="package_type" value="包" id="radio3" /> 76 包 77 <input type="radio" name="package_type" value="瓶" id="radio4" /> 78 瓶</label> 79 <input type="radio" name="package_type" value="袋" id="radio5" /> 80 <label for="checkbox6">袋</label></td> 81 </tr> 82 <tr> 83 <th height="74" scope="row">产地</th> 84 <td><label for="select"></label> 85 <select name="place" size="6" multiple="multiple" id="place"> 86 <option value="henan">河南</option> 87 <option value="河北">河北</option> 88 <option value="湖南">湖南</option> 89 <option value="湖北">湖北</option> 90 <option value="shanghai">上海</option> 91 <option value="其他">其他</option> 92 </select> 93 </td> 94 </tr> 95 <tr> 96 <th height="74" scope="row">赠品标志</th> 97 <td><label> 98 <input name="type_flg" type="checkbox" id="type_flg" value="商场促销" /> 99 可参加商场促销 100 <br /> 101 <input name="type_flg" type="checkbox" id="type_flg" value="厂商活动" /> 102 可参加厂商活动 103 <br /> 104 <input name="type_flg" type="checkbox" id="type_flg" value="赠品" /> 105 可作为赠品 106 </label></td> 107 </tr> 108 <tr> 109 <th height="39" scope="row">删除标志</th> 110 <td><label> 111 <input name="del_flg" type="radio" value="有效" checked="checked" /> 112 有效 113 <input type="radio" name="del_flg" value="无效" /> 114 无效</label></td> 115 </tr> 116 <tr> 117 <th height="31" scope="row">备注</th> 118 <td><label for="textfield"></label> 119 <label for="textarea"></label> 120 <textarea name="memo" cols="35" rows="5" id="memo"></textarea> 121 <label for="file"></label></td> 122 </tr> 123 </table> 124 <br /> 125 <table width="206" align="center"> 126 <tr> 127 <td width="101"><input type="submit" name="Submit" value="提交" id="Submit" /></td> 128 <td width="93"><label for="label"></label> 129 <input type="reset" name="Submit2" value="重置" id="label" /> 130 <input name="action" type="hidden" id="action" value="add" /></td> 131 </tr> 132 </table> 133 </form> 134 </body> 135 </html>