Tomcat 6.0 does not allow the use of a generic ArrayList to use a Bean

In the jsp file, I have this declaration:

<jsp:useBean scope="request" id="products" class="java.util.ArrayList<sgt.supermarket.entity.Product>"/>

This expression works fine with GlassFish 2.1, however, when I switch to Tomcat 6.0, exceptions are thrown:

The value of the useBean attribute of the java.util.ArrayList class is not valid.

Is there any library skipped for Tomcat that makes it different from Glass Fish 2.1?

+3
source share
2 answers

EL , . JSP/EL . EL . , , "" Glassfish, JSP/EL.

, jsp:useBean MVC, Servlet .

List<Product> procucts = productDAO.list();
request.setAttribute("products", products);
request.getRequestDispatcher("products.jsp").forward(request, response);

products EL ${products}. jsp:useBean.

+5

JSP-, :

<% request.setAttribute("products", 
       new java.util.ArrayList<sgt.supermarket.entity.Product>()); %>

BalusC - : MVC, , . , JSP, Java-.

0

Source: https://habr.com/ru/post/1725697/


All Articles