int i = 0;
String[] pnumbers = new String[3];
String[] pqtys = new String[3];
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String pnumber = request.getParameter("pnumber");
DAO dao = new DAO();
Product p = dao.checkProduct(pnumber);
String qunty = request.getParameter("pqty");
while (i < 3) {
pnumbers[i] = p.getNumber();
pqtys[i] = p.getQty();
i++;
}
request.setAttribute("pnum" pnumbers);
}
我需要将来自网页的 3 个项目添加到此数组中。但是您可以添加一项
<td>
<input type="text" name="pnumber" value="" />
</td>
<td>
<input type="text" name="pqty" value="" />
</td>
在添加这 3 个项目后,我只需要将 3 个项目添加到数组中,我需要再次将该值获取到同一页面,请帮忙?