Java Server Pages
A JSP source code file is a file with a .jsp extension which has HTML and Java code. Although a JSP source code file often looks more like a regular HTML file than like a servlet, behind the scenes the JSP page is automatically converted to a normal servlet, with the static HTML simply being printed to the output stream associated with the servlet. This translation is normally done the first time [...]DOWNLOAD REFERAT
Preview referat: Java Server Pages
The first time a JSP document is loaded by the JSP container (which is typically associated with, or even part of, a Web server), the servlet code necessary to fulfill the JSP tags is automatically generated, compiled, and loaded into the servlet container (the JSP page is transformed into a servlet). The static portions of the HTML page are produced by sending static String objects to the out.write( ) method (out of type JspWriter). The dynamic portions are included directly into the servlet.
From then on, as long as the JSP source for the page is not modified, it behaves as if it were a static HTML page with associated servlets (all the HTML code is actually generated by the servlet, however). If the source code for the JSP is modified, it is automatically recompiled and reloaded the next time the page is requested. The servlet associated to the JSP page is the one that processes any request for the page.
Aside from the regular HTML, there are three main types of JSP constructs that can be embedded in a page: scripting elements, directives, and actions. Scripting elements allow the specifying of Java code that will become part of the resultant servlet, directives allow the control of the overall structure of the servlet, and actions allow the specifying of existing components that should be used and otherwise control the behaviour of the JSP engine.
5.1.1. Scripting Elements
There are three scripting language elements: declarations, scriptlets, and expressions. A declaration will declare elements, a scriptlet is a fragment of java code statements, and an expression is a complete statement expression in java. In JSP each scripting element begins with a "" tag. The syntax for each is:
« mai multe referate din Informatica