TheJavaCode.com
http://www.thejavacode.com/

Java Server Pages
http://www.thejavacode.com/viewtopic.php?f=37&t=9770
Page 1 of 1

Author:  msafwat [ Tue Sep 14, 2010 6:49 am ]
Post subject:  Java Server Pages

JavaServer Pages (JSPs) are server-side Java EE components that generate responses, typically HTML pages, to HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters %>. A JSP is compiled to a Java 'servlet', a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.

Architecturally, JSP may be viewed as a high-level abstraction of Java servlets. JSP pages are loaded in the server and operated from a structured special installed Java server packet called a Java EE Web Application, often packaged as a .war or .ear file archive.

A servlet is the exact same concept--a piece of Java code that runs on the server in response to a browser request. Servlets support the request/response client/server model and are able to service HTTP GET and POST requests. They are a replacement for CGI bin and php etc...

Many dynamic pages on the net are generated by Java code on a server and spit back to the browser, which pretends everything is a static file.
A servlet is a Java component that can be plugged into a Java-enabled web server to ... Sample Servlet. The code below implements a simple servlet that returns a static HTML page

JSPs are compiled into servlets by a JSP compiler. The compiler either generates a servlet in Java code that is then compiled by the Java compiler, or it may compile the servlet to byte code which is directly executable. JSPs can also be interpreted on-the-fly, reducing the time taken to reload changes. Regardless of whether the JSP compiler generates Java source code for a servlet or emits the byte code directly, it is helpful to understand how the JSP compiler transforms the page into a Java servlet. For example, consider the following input JSP and its resulting generated Java Servlet. Input JSP Resulting servlet

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/