arraylist在jsp中选择一个选项

时间:2017-08-25 17:18:43

标签: java jsp servlets arraylist

如何指定一个arraylist来选择jsp中的选项?我找到了一个例子(how to assign arraylist to select option in jsp),但仍然得到空选项。

SELECT name,
IF(SUM(IF(Paris='y',1,0)>0,'y','') as Paris,
IF(SUM(IF(London='y',1,0)>0,'y','') as London,
IF(SUM(IF(NYC='y',1,0)>0,'y','') as NYC
FROM location
GROUP BY name

JspCode

IndexServlet.java

@WebServlet("/IndexServlet")
public class IndexServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<String> databaseArrayList = new ArrayList();
        databaseArrayList.add("1");
        databaseArrayList.add("2");
        databaseArrayList.add("3");
        request.setAttribute("databaseList", databaseArrayList);
        request.getRequestDispatcher("AddManager.jsp").forward(request, response);
        System.out.println("in index servlet");
}
}

1 个答案:

答案 0 :(得分:-1)

您没有转发请求..

<label class="btn btn-default" (click)="changeFilter('1')">
    <input type="radio" autocomplete="off">1
</label>