我尝试了所看到的一切,但没有成功,如果有人可以帮助那个,那个男人......
问题在于: 我不能成功地将一个arraylist从servlet放到jsp中,eclipse在JSP中向我显示:Uncheked从Object转换为ArrayList,
那是我的Servlet代码
filhoArray = dao.consultar_cpf(mae);
request.setAttribute("filho", filhoArray);
getServletConfig().getServletContext().getRequestDispatcher("/resultado-consulta.jsp").forward(request,response);
和JSP
Bebe bebe = new Bebe();
ArrayList<Bebe> list = (ArrayList<Bebe>) request.getAttribute("filho");
System.out.println(list);
out.print(list);
答案 0 :(得分:2)
这是您从非泛型类型转换为泛型类型的warning。 在您的特殊情况下,您无法避免这种演员表,因此您可以通过以下方式使警告静音:
@SuppressWarnings("unchecked")
ArrayList<Bebe> list = (ArrayList<Bebe>) request.getAttribute("filho");