Java Server Pages referat





According to Sun\'s web site, \"JSP technology is an extension of the servlet technology created to support authoring of HTML and XML pages\". Java Server pages appeared as the technology of using servlets showed out some disadvantages. One of the disadvantages is that for a simple Http response page, the code was quite large because it had to declare parameters, methods, writing HTML tags, etc. Another disadvantage was that for a single change, there was needed a skilled programmer. Observing all this, Sun developed a new technology, namely Java Server Pages, which are an extension to the servlet technology. The news was that a programmer could include in a static HTML page, portions of code. The extensions of the new files are .jsp. Here is made the delimitation first for example between the task of the web designer and the task of a code programmer.
There are two phases' processes that involve JSP pages:
o translation phase
As regarding the translation phase-also called compilation of the JSP pages-, these pages are translated to servlets before being run. This translation involves conversion of JSP source code into servlet source code by the JSP container. (this step called as compilation of a JSP page into a servlet, it is different from compilation of Java code into bytecodes.) After this translation, the servlet class is, itself, compiled. Because JSP pages are translated to servlets, they inherit servlets' request/response model. JSP pages, like servlets, are called in response to requests, and they produce responses. When the JSP container translates the body of a JSP page into a servlet, it produces a new class that implements the javax.servlet.Servlet interface. This class has a method called _jspService() that is built from the body of the JSP page.



o Execution phase.
This phase takes place when the request is received by a container and the servlet is run. The output of the servlet is sent back to container which sends it out to the user interface
Another observation necessary to be made is that the translation phase occurs only when it's necessary, not being performed each time the request for that page is made. The process of translating the JSP page into a servlet and running each time can be time-consuming. The JSP container manages the requests as followings: as long as there is no change in the JSP page, there is no need to translate the JSP page again and obtain a new servlet. The JSP container checks if the JSP pages suffered from modifications from last time when requested.









Copyright © Contact | Trimite referat