Java Reference
In-Depth Information
What are JavaServer Pages?
JavaServer Pages, also known as JSPs, are a simple but powerful technology used to generate
dynamic HTML on the server side. They are a direct extension of Java servlets and provide a
way to separate content generation from content presentation. The JSP engine is just another
servlet that is mapped to the extension *.jsp . The following code contains a simple example
of a JSP file:
<HTML>
<BODY>
<% out.println(“HELLO JSP WORLD”); %>
</BODY>
</HTML>
Its output would look similar to Figure 14.1.
F IGURE 14.1
Output of the JSP example.
You can see that this document looks like any other HTML document with some added tags
containing Java code. The source code is stored in a file called HelloJSPWorld.jsp and copied
to the document directory of the Web server. When a request is made for this document, the
server recognizes the *.jsp extension and realizes that special handling is required. The first
Search WWH ::




Custom Search