JSP tags <c:forEach> Remove pass parameters note

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.