We often do the following inside the scriptlet:
<%
request.getCookies();
%>
Can anyone tell me, what is request
here? I know it represents HttpServletRequest
but I haven't declared it. I just do not understand this.
We often do the following inside the scriptlet:
<%
request.getCookies();
%>
Can anyone tell me, what is request
here? I know it represents HttpServletRequest
but I haven't declared it. I just do not understand this.
request
is a variable of type HttpServletRequest
that is declared and initialized for you in the code generated by the servlet container when the JSP code is transformed into a Servlet class and compiled, it also known as one of implicit objects in JSP.
Note that using scriptlets in JSP is bad practice for years. You should learn JSP EL, the JSTL, and choose an MVC framework that allows separating the Java code for the pure markup-generation code.