Wednesday, August 7, 2013

How jsp is translated in to servlet ?

What happens to jsp page during translation phase ?
How different jsp elements map to translated servlet and
where they will be landed ?
-------------------------------------------------------------------

Hi Guys.. check.. jspServletEx.jsp file
and
jspServletEx_jsp.java(This is translated servlet java code) that I uploaded..

In netbeans you can easily see the translated servlet code..
Right click on jspServletEx.jsp and click on view servlet.

1)All the Scriptlet code and expression tag and html you write in
jsp goes to _jspService method in translated servlet.

2)All the content in scriptlet and expression elements
lands in _jspService method in coverted servlet



3)All the variable declared in declaration element go to class level.
observe where classLevelVar exists in servlet


4)You can override init and destroy methods in jsp with the help of
jspInit and jspDestroy.All the scriptlet,expression and html code
lands into _jspService method.

No comments:

Post a Comment