The orders to compile jsp

(The Information is from http://www.jguru.com/faq/view.jsp?EID=421448 . If any question, pls tell me to delete it immediately. )

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?

The answer:

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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值