Run the code in the book, where the servlet can pass parameters to the JSP in the following two ways:
1.request.getsession (). SetAttribute ("ProductList", productlist);response.sendredirect ("displayallproduct_3.jsp");2.Request.setattribute ("ProductList", productlist);RequestDispatcher rd = Request.getrequestdispatcher ("/displayallproduct_2.jsp");Rd.forward (request, response);The process of extracting parameters from the El expression in the JSP page is then ignored: <c:foreach var= "Product" items= "${
Requestscope. productlist} "varstatus=" Status > and <c:foreach var= "product" items= "${
SessionscopeThe difference between the. ProductList} "varstatus=" Status >The
object is taken out of the foreach statement and is named Var xx, and XX is the alias of the collection you want to loop, Varstatus is the cyclic index,Note: The parameter is obtained through requestscope.productlist, so the servlet must be accessed first before the result output
JSP tags <c:forEach> Remove pass parameters note