Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP .class and .xml files generation  RSS feed

 
mike zhang
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For each "my.jsp" file, the server creates a "my.java", a "my.class" file and a "my.xml" file for it. For the first time this "my.jsp" file is accessed, there is no "my.class" and "my.xml" file yet so server has to create them.
Later on, when will the "my.class" file be re-created ? does this happen ONLY when you change the "my.jsp" file itself ? If "my.jsp" contains lot of "useBean", "getProperty" kind stuff, so dynamically the jsp page's contents keep changing, but this doesn't mean "my.class" is changed, right ? when the "getProperty" feeds different content to jsp page, server still uses the old "my.class" file, right ?
Just want to confirm.
thanx,
mike
 
Angela Margot
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Bill Brogden's "Java Developer's Guide To JavaServer Pages & Servlets" (a very good JSP/servlet book) the following steps take place with JSP pages and compiling:
1- A request naming a JSP page is directed to the JSP engine by the Web server
2- The JSP engine looks for the corresponding servlet based on the page name. If thesrevlet exists and is up t date, the request is passed to the servlet _jspService method using HttpServletRequest and HttpServletResponse objects just like with a regular servlet.
3- If the source page has been changed or has never been compiled the page compiler parses the source an createes the equivilent Java source code for a servlet, extending HttpJSPServlet
4- This code is then compiled, and the new servlet is executed. The servlet object can stay in memory, providing a very fasts response to the next request.
Hope it helps! ps- thanks Bill B!
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also realize that most app servers can be configured as to WHEN a JSP is recompiled: when Changed, first Request Always, first Request if Needed, Never, etc.
Check with your app server docs to see when these files will be created and where they are placed when they are.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!