Java server pages converted to servlet?

I read that inside the web server the jsp page is being converted to a servlet. When does this conversion take place? Should I run a specific command?

+3
source share
3 answers

This is done at runtime when the JSP is called for the first time. Some web servers also come with a JSP compiler to do this during build, which has two advantages:

  • It allows JSP syntax errors to be detected at build time, not runtime
  • This avoids the first penalty time of the call (it takes some time to compile the JSP into Java, and then Java into bytecode).
+4
source

JSP , JSP .
Apache TomCat, JSP, .java .class \work TomCat.


, , test.jsp
\Apache Software Foundation\Tomcat 5.5\webapps\jsp\
(.java .class )
\Apache Software Foundation\Tomcat 5.5\work\Catalina\localhost\jsp\org\apache\jsp\

+3

This is done automatically for you when the JSP page is requested, so you do not need to run the command. Sometimes you can precompile your JSPs, etc., but this is not a requirement.

This page explains the life cycle of a JSP page.

+1
source

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


All Articles