【问题标题】:Retrieve whole table in servlet在 servlet 中检索整个表
【发布时间】:2014-03-18 12:54:57
【问题描述】:

我想知道是否可以从动态构建的表中获取所有行值。 我想用 request.getParameter(...) 像其他参数一样取回它

有可能吗?

提前致谢

我的桌子:

<table id="table_produits" >
       <tbody>
          <tr>
              <td style="width: 80px;"><label for="u_codep">Produit </label></td>
              <td><select class="span8" name="id_produit">


    <%
                                                                    List<Produit> l;
                                                                        ProduitDao pdao = new ProduitDao();
                                                                        l = pdao.GetAll();
                                                                        int j = 0;

                                                                        while (j < l.size()) {
                                                                    %>
                                                                    <option value="<%=l.get(j).getId()%>">
                                                                        <%=l.get(j).getLibelle()%></option>
                                                                    <%
                                                                        j++;
                                                                        }
                                                                    %>
                                                        </select>
                                                        <td></td>
                                                        <td style="width: 35px;"><label for="u_quantite">
                                                                Quantité </label></td>
                                                        <td valign="top"><input type="text" id="u_quantite"
                                                            value="${nouvelleVente.quantité}" name="quantite"
                                                            class="span8" size="50" style="width: 50%;" /></td>
                                                        <td><i class="glyphicon glyphicon-plus"
                                                            onclick="javascript:newLine();"></i>
                                                        <td />
            =                                       </tr>
                                                </tbody>
                                            </table>

【问题讨论】:

  • 在您尝试执行此操作的位置显示您的 servlet 代码。

标签: jsp jakarta-ee servlets


【解决方案1】:

只需了解如何执行此操作:使用 getParameterValues()

例如-> String[] produits = request.getParameterValues("id_produit");

感谢 developerwjk 提供帮助

【讨论】:

    猜你喜欢
    • 2016-12-05
    • 1970-01-01
    • 2012-10-14
    • 1970-01-01
    • 2010-11-11
    • 2015-10-12
    • 1970-01-01
    • 2013-03-19
    • 2023-03-21
    相关资源
    最近更新 更多