What happens when the JSP completes execution?

When the JSP completes execution, will all the variables declared on the JSP page be garbage collected? If I declare multiple Hashtables of memory in the JSP, and I allow the JSP to complete execution without first setting the variables to zero, will the object remain in memory even after the JSP completes?

(I do not store them in a constant variable, such as a session. Only in a local variable.)

+3
source share
3 answers

If variables are declared in a request or page area, yes, they have the right to garbage collection.

null, , 1. 0, .

+3

, JSP- JSP- ( ). , , jspDestroy() .

0

, Java JSP, Jasper . ( JSP-, , , .. .) Tomcat Ant.

script Java test.jsp :

@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET ANT_HOME=C:\dev\apache-ant-1.7.1
SET TOMCAT_HOME=C:\Program Files\Apache Software Foundation\Tomcat 6.0
SET CLASSPATH="
FOR /r "%TOMCAT_HOME%\bin\" %%a IN (*.jar) DO SET CLASSPATH=!CLASSPATH!;%%a
FOR /r "%TOMCAT_HOME%\lib\" %%a IN (*.jar) DO SET CLASSPATH=!CLASSPATH!;%%a
SET CLASSPATH=!CLASSPATH!;%ANT_HOME%\lib\ant.jar"
MKDIR output
java org.apache.jasper.JspC -d .\output -webapp .\WebContent test.jsp

WebContent is the root directory of the web application. The generated code is a servlet and will follow the servlet's life cycle as defined in the specification.

0
source

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


All Articles