您的表单需要提交,例如有一个提交按钮。并且您需要将参数作为输入。
request.setAttribute在表单内部调用不会执行任何操作。设置请求属性的目的是在您要使用调度程序转发请求时使用,而不是在使用表单时。
<% int z=1; %><form method="Post" action="servlet"> <input type="text" name="username" /> <input type="password" name="password" /> <input type="hidden" name="product_no" value="<%=z%>" /> <input type='submit' /></form>



