How do I pass information from a servlet to a JSP page

后端 未结 4 1191
日久生厌
日久生厌 2020-12-06 02:45

Is it possible to have a servlet that contains an object (an ArrayList in this case) that then does the equivalent of displaying a jsp page and passing that object to the js

4条回答
  •  北海茫月
    2020-12-06 03:29

    You can pass objects to jsp's by embedding them within the Request.

    request.setAttribute("object", object);

    and within the jsp:

    request.getAttribute("object");

提交回复
热议问题