<%! String[] fruits; %>
The checked fruits (got using request) are:
<% fruits = request.getParameterValues("fruit"); %>
    <% if (fruits != null) { for (int i = 0; i < fruits.length; i++) { %>
  • <% out.println (fruits[i]); } } else out.println ("none selected"); %>


The checked fruits (got using beans) are
<% fruits = foo.getFruit(); %>
    <% if (!fruits[0].equals("1")) { for (int i = 0; i < fruits.length; i++) { %>
  • <% out.println (fruits[i]); } } else out.println ("none selected"); %>