[ Team LiB ] Previous Section Next Section

Summary

In this hour you learned that JavaServer Pages can use the Java programming language and all of its component technologies to develop Web applications. JSPs mostly consist of scriptlets, which are fragments of Java code that can be mixed with HTML to produce Web pages with dynamic content. Writing to the current output stream occurs frequently, so JSP provides an abbreviated method to produce text output that is inserted into the resulting document. Java expressions can be enclosed in <%= and %> tags, and the results will automatically be output as a string. Code generated from scriptlets and expressions belong to a single method that handles requests on behalf of a JSP. You can also declare methods and variables outside of the scope of that method by enclosing your declarations inside of <%! and %> tags. Scriptlets and expression and declaration elements are ultimately all part of a servlet that is produced by a JSP container when a request for a JSP is made. By default, a JSP container uses a single servlet to handle multiple requests by using multithreading, making it important to be aware of issues related to concurrency. These problems are often easily solved by using Java's mechanisms for synchronization or by good design.

    [ Team LiB ] Previous Section Next Section