When a jsp compiler compiles the jsp page, in what order does it get compiled? Specifically if I have scriptlets ,tags, includes and expressions, what would be the order of compilation for these four. Is there a document somewhere that defines this?

Alessandro A. Garbagnati

The order of compilation it's really based on the jsp page itself.
The JSP page is converted to a java source file. This is done inserting the "content of the page" inside a skeleton. The order is the same order that you have in the page.

Let's suppose that in the page there are:

1) a scriptlet
2) a custom tag
3) static html
4) a jsp:include
5) an expression
6) an page include

the java generated file will contain:

1) the scriptlet code
2) the custom tag creation; all attributes are converted to tag setters
3) static html will be converted with something similar to response.getWriter().write(<the static html>)
4) the call for including the external file
5) the expression converted to java code for output
6) the content of the included page inserted in the java code.

As you can see, there is no specific order. Once the java source file is created, the compiler takes care of generating the servlet code, following the normal process.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact