Escolar Documentos
Profissional Documentos
Cultura Documentos
Roll:61
INTRODUCTION
Java Server Pages (JSP) is a Java technology that helps software developers serve
dynamically generated web pages based on HTML, XML, or other document types.
Released in 1999 as Sun's answer to ASP and PHP, JSP was designed to address the
perception that the Java programming environment didn't provide developers with
enough support for the Web.
OVERVIEW
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.
JSP allows Java code and certain pre-defined actions to be interleaved with static web
markup content, with the resulting page being compiled and executed on the server to
deliver an HTML or XML document. The compiled pages and any dependent Java
libraries use Java byte code rather than a native software format.
JSP syntax is a fluid mix of two basic content forms: scriptlet elements and markup.
Markup is typically standard HTML or XML, while scriptlet elements are delimited
blocks of Java code which may be intermixed with the markup.
The JSP syntax adds additional XML-like tags, called JSP actions, to invoke built-in
functionality. Additionally, the technology allows for the creation of JSP tag libraries that
act as extensions to the standard HTML or XML tags. JVM operated tag libraries provide
a platform independent way of extending the capabilities of a web server.
Multi platform.
Component reuse by using Javabeans and EJB.
Advantages of Java.
You can take one JSP file and move it to another platform,web server or JSP Servlet
engine.
This means you are never locked into one vendor or platform.
HTML and graphics displayed on the web browser are classed as the presentation layer.
The Java code (JSP) on the server is classed as the implementation.
JSP architecture
JSPs are built on top of SUN Microsystems servlet technology. JSPs are essential an
HTML page with special JSP tags embedded. These JSP tags can contain Java code. The
JSP file extension is .jsp rather than .htm or .html. The JSP engine parses the .jsp and
creates a Java servlet source file. It then compiles the source file into a class file,this is
done the first time and this why the JSP is probably slower the first time it is accessed.
Any time after this the special compiled servlet is executed and is therefore returns faster.
Creating your first JSP page
<html>
<head>
<title>My first JSP page
</title>
</head>
<body>
<%@ page language="java" %>
<% out.println("Hello World"); %>
</body>
</html>
Type the code above into a text file. Name the file helloworld.jsp.
Place this in the correct directory on your JSP web server and call it via your browser.