<input type="checkbox" name="premium" value="HBO">HBO <br>
<input type="checkbox" name="premium" value="FOXP">FOX Película <br>
<input type="checkbox" name="premium" value="FOX">FOX + <br><br>
<input type="submit" value="cotizar" name="Cotizar" />
<br><br>


我正在尝试从index.jsp中将复选框的premium参数引入Web服务客户端的servlet中。我必须将其保存为列表,但是我尝试过的没有用

 protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String plan = request.getParameter("plan");
    String  PREMIUM = request.getParameter("premium");


如何将request.getParameter(“ premium”)转换为列表?

最佳答案

尝试这个:

String[] premiums = request.getParameterValues("premium");

10-06 09:16