You are on page 1of 1

A JSP becomes a servlet. A servlet that you dont create.

The Container looks at your JSP,


translates it into Java source code, and compiles it into a full-fl edged Java servlet class. But
youve got to know what happens when the code you write in the JSP is turned into Java code.
You can write Java code in your JSP, but should you? And if you dont write Java code, then
what do you write? How does it translate into Java code? In this chapter, well look at
six different kinds of JSP elementseach with its own purpose and, yes, unique
syntax. Youll learn how, why, and what to write in your JSP. Perhaps more
importantly, youll learn what not to write in your JSP.
In the end, a JSP is just a servlet Your JSP eventually becomes a full-fledged servlet running in
your web app. Its a lot like any other servlet, except that the servlet class
is writen for youby the Container. The Container takes what youve written in your JSP,
translates it nto a servlet class source (.java) file, then compiles that into a Java servlet class.
After that, its just servlets all the way down, and the servlet runs in exactly the same way it
would if youd written and compiled the code yourself. In other words, the Container loads the
servlet class, instantiates and initializes it, makes a separate thread for each request, and calls the
servlets service() method.

You might also like