Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
JSP v2

JSP v2

Ratings: (0)|Views: 104 |Likes:
Published by api-3819971

More info:

Published by: api-3819971 on Oct 17, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





JavaServer Pages
(JSP ) v2.0 Syntax Reference
Core Syntax
Documents the JSP page but is not inserted into the response.
Declares a variable or method valid in the scripting language used in the
Contains an expression valid in the scripting language used in the page.
Contains a code fragment valid in the scripting language used in the page.
EL Expression
Contains an expression in the JSP Expression Language (EL). See Expression
Language section below for the syntax.
Declares an attribute of the custom tag defined in the tag file.
Include DirectiveIncludes a resource of text or code when the JSP page is translated.
Page Directive
Defines attributes that apply to an entire JSP page.
Tag Directive
Similar to the page directive in a JSP page, but applies to tag files instead of
JSP pages.
Taglib Directive
Defines a tag library and prefix for the custom tags used in the JSP page.
Defines an expression language variable exposed by the tag to the calling
<jsp:attribute>Used as a substitute for attributes of standard or custom actions.
Explicitly defines an element body. This tag is required if the enclosing
element contains any jsp:attribute tags.
Dynamically generates an XML element
Evaluates the body of the tag used by the calling page to invoke this tag file.
Forwards a request to an HTML file, JSP page, or servlet.
Inserts the value of a bean property into the response.
Includes a static resource or the result from another web component
Evaluates a fragment attribute.
Specifies the XML declaration or the document type declaration in the
request output of a JSP document or a tag file that is in XML syntax.

Causes the execution of an applet or bean. The applet or bean executes in
the specified plugin. If the plugin is not available, the client displays a dialog
to initiate the download of the plugin software.

Defines standard elements and namespace attributes of tag libraries.
Sets a bean property value or values.
Encloses template data.
Instantiates or references a bean with a specific name and scope.
Copyright \u00a9 2004, 2005, Sun Microsystems, Inc. All rights reserved.
JavaServer Pages
(JSP ) v2.0 Syntax Reference
All tags are case sensitive. A pair of single quotes is equivalent to a pair of double
quotes. Spaces are not allowed between an equals sign and an attribute value.
The elements in a JSP page can be expressed in JSP syntax or XML syntax. The
following rules apply:
JSP and XML syntax cannot be mixed within a page.
A page in one syntax can include or forward to a page in the other syntax.
Quoting Conventions
The following outlines quoting conventions for JSP pages expressed in JSP syntax.
Scripting Elements
%> by %\>
EL Expressions
a literal ${ by '${'
Template Text
<% by <\%
Only when the EL is enabled for a page, a literal $ by \$. This is used for
quoting EL expressions.
' as \'. This is required within a single quote-delimited attribute value.
" as \". This is required within a double quote-delimited attribute value.
\ as \\
%> as %\>
<% as <\%
&apos; and &quot; can be used to indicate single and double quotes.
Typographic Conventions
code =
bold = default
italics = user-defined | = or
[ ]=
{ } = required
... = list of items
+ = can
' ' = literal
() = grouped
^ = anything other
- = a range
Copyright \u00a9 2004, 2005, Sun Microsystems, Inc. All rights reserved.
JavaServer Pages
(JSP ) v2.0 Syntax Reference
Some action elements have attributes whose value can be computed at request time.
In JSP syntax, the format of such a value is the same as a JSP expression: <%=
expression %>. In XML syntax, the format of the value is %= expression %. When
using the JSP expression language (EL), the format of the value in either syntax is ${

EL expressions can be quoted by adding a backslash to the front of the expression when the expression language is enabled. This prevents the expression from being evaluated. Example: \${x+y} will display as ${x+y}.

All elements in XML syntax can contain an xmlns attribute that complies with the XML
namespaces spec. This attribute is used to declare tag libraries and other
namespaces. Within the start tag of an element, its syntax is

All JSP standard actions and custom actions can contain a jsp:attribute standard
element as a substitute for any of its attributes. The jsp:attribute syntax is
<jsp:attribute name="attributeName" [ trim="true | false" ] />

If an action contains any jsp:attribute elements and the action also has a body, it
must use the jsp:body tag to represent the body. The jsp:body syntax is <jsp:body>
any elements or text</jsp:b ody>
Documents the JSP page but is not inserted into the response.
JSP Syntax
<%--com ment --%>
XML Syntax
<!--com ment -->

<%@ page language="java" %>
<head><title>A Comment Test</title></head>
<h2>A Test of Comments</h2>
<%-- This comment will not be included in the response --%>


A comment marks text or lines that the JSP container should ignore. A comment is
useful when you want to comment out part of your JSP page. The JSP container does
not process anything within the <%-- and --%> characters or within the <!-- and -->
characters. A comment is not inserted into the response.

Copyright \u00a9 2004, 2005, Sun Microsystems, Inc. All rights reserved.

Activity (7)

You've already reviewed this. Edit your review.
1 hundred reads
shahidrana1122 liked this
shahidrana1122 liked this
grandsunil liked this
ssoni83 liked this
tuanle22 liked this
tuanle22 liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->