JSP

From VYRE

Jump to: navigation, search

JavaServer Pages (JSP) is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents in response to a web client request. The technology allows Java code and certain pre-defined actions to be embedded into static content.

The JSP syntax adds additional XML-like tags, called JSP actions, to be used 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. Tag libraries provide a platform independent way of extending the capabilities of a web server.

JSPs are compiled into Java Servlets by a JSP compiler. A JSP compiler may generate a servlet in Java code that is then compiled by the Java compiler, or it may generate byte code for the servlet directly. JSPs can also be interpreted on-the-fly reducing the time taken to reload changes.

Some Snippets

Output comments:

<!-- comment [ <%= expression %> ] -->

Hidden comments:

<%-- hidden comment --%>

Declarations:

<%! declarations %>

Expressions:

<%= expression %>

Scriptlets:

<% code fragment %>

Include Directive:

<%@ include file="relativeURL" %>

Page Directive:

<%@ page 
  [ language="java" ] 
  [ extends="package.class" ] 
  [ import= "{ package.class | 
    package.* }, ..." ] 
  [ session="true|false" ] 
  [ buffer="none|8kb|sizekb" ] 
  [ autoFlush="true|false" ] 
  [ isThreadSafe="true|false" ] 
  [ info="text" ] 
  [ errorPage="relativeURL" ] 
  [ contentType="mimeType [ 
    ;charset=characterSet ]" | 
    "text/html ; charset=ISO-8859-1" ] 
  [ isErrorPage="true|false" ] 
%>

jsp:forward tag:

<jsp:forward page= 
     "{ relativeURL | <%= expression %> }" >

Other Links

Commonly used Unify JSP code

External links

This article is licensed under the GNU Free Documentation License. It uses material from the Pages Wikipedia article "JavaServer Pages".

Personal tools