GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Scriptlet, EL, JSTL, Custom tags, what is the loading/rendering sequence? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Scriptlet, EL, JSTL, Custom tags, what is the loading/rendering sequence?" Watch "Scriptlet, EL, JSTL, Custom tags, what is the loading/rendering sequence?" New topic
Author

Scriptlet, EL, JSTL, Custom tags, what is the loading/rendering sequence?

Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
Hi fellow Ranchers,
Does anybody know about the loading sequence when a jsp file contains scriptlets, EL, JSTL/custom tags? What I mean is which is being read first before which? Or does their position in the jsp file is the only thing that matters? Thanks in advance.

Lhorenz
[ July 10, 2008: Message edited by: lhorenz baylon ]

I just cant look, its killing me.
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Scriplets are embedded in the servlet generated from the JSP page - so obviously only their position matters. EL is similar, but uses the EL API behind to scenes to achieve it's goal - again, this is invoked in a procedural manner as the part of the page containing the EL is executed.

Actions (including JSTL and custom tags) are also executed when they are encountered in the page, though there are multiple methods to invoke in this case since tags have their own lifecycle which can be quite complicated. Nevertheless, these are all invoked in the correct sequence by the container at the point the tag is found in the page (otherwise your output wouldn't be where you'd expect it!). There is a slight complication here: sometimes to save on object counts (memory overheads), a JSP page will reuse the same tag handler instance for multiple invocations of the tag - but you don't need to worry about this as the container will handle it all seamlessly (it is a container-dependent feature too).


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
Thanks Charles! I was thinking earlier that they are being translated/evaluated at different phase/pass though the jsp file translation. Very well said. Thank you.

Lhorenz
 
GeeCON Prague 2014
 
subject: Scriptlet, EL, JSTL, Custom tags, what is the loading/rendering sequence?