Jsp include, forwarding request parameter

In my jsp file I am retrieving data from the request via request.getAttribute().

Inside this jsp I need to include another jsp. Will it be included jsp have access to the request or do I need to somehow forward the data?

+3
source share
1 answer

It will be available:

  • if you use static include ( <%@ include file=".." %>), then the body of the included file is placed in the method of the doGet(..)generated servlet (each JSP is converted to a servlet), so logically, the source object is available here request.

  • include (<jsp:include>), RequestDispatcher.include(..) ( ). , ServletRequest, , .

, Java- JSP . EL JSTL. request.getAttribute("x") ${x}.

+6

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


All Articles