Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
7Activity
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

Availability:

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

03/18/2014

pdf

text

original

JavaServer Pages
(JSP ) v2.0 Syntax Reference
CONTENTS
Core Syntax
Description
Comment
Documents the JSP page but is not inserted into the response.
Declaration
Declares a variable or method valid in the scripting language used in the
page.
Expression
Contains an expression valid in the scripting language used in the page.
Scriptlet
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.
Directives
Description
Attribute
Directive
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.
Variable
Directive
Defines an expression language variable exposed by the tag to the calling
page.
Standard
Actions
Description
<jsp:attribute>Used as a substitute for attributes of standard or custom actions.
<jsp:body>
Explicitly defines an element body. This tag is required if the enclosing
element contains any jsp:attribute tags.
<jsp:element>
Dynamically generates an XML element
<jsp:doBody>
Evaluates the body of the tag used by the calling page to invoke this tag file.
<jsp:forward>
Forwards a request to an HTML file, JSP page, or servlet.
<jsp:getProperty
>
Inserts the value of a bean property into the response.
<jsp:include>
Includes a static resource or the result from another web component
<jsp:invoke>
Evaluates a fragment attribute.
<jsp:output>
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.
<jsp:plugin>

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.

<jsp:root>
Defines standard elements and namespace attributes of tag libraries.
<jsp:setProperty
>
Sets a bean property value or values.
<jsp:text>
Encloses template data.
<jsp:useBean>
Instantiates or references a bean with a specific name and scope.
Copyright \u00a9 2004, 2005, Sun Microsystems, Inc. All rights reserved.
1
JavaServer Pages
(JSP ) v2.0 Syntax Reference
Preface
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:
\u2022
JSP and XML syntax cannot be mixed within a page.
\u2022
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
\u2022
%> by %\>
EL Expressions
\u2022
a literal ${ by '${'
Template Text
\u2022
<% by <\%
\u2022
Only when the EL is enabled for a page, a literal $ by \$. This is used for
quoting EL expressions.
Attributes
\u2022
' as \'. This is required within a single quote-delimited attribute value.
\u2022
" as \". This is required within a double quote-delimited attribute value.
\u2022
\ as \\
\u2022
%> as %\>
\u2022
<% as <\%
\u2022
&apos; and &quot; can be used to indicate single and double quotes.
Typographic Conventions
code =
fixed
bold = default
italics = user-defined | = or
[ ]=
optional
{ } = required
choice
... = list of items
+ = can
repeat
' ' = literal
() = grouped
together
^ = anything other
than
- = a range
Copyright \u00a9 2004, 2005, Sun Microsystems, Inc. All rights reserved.
2
JavaServer Pages
(JSP ) v2.0 Syntax Reference
Notes
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 ${
expression}.

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
[xmlns:taglibprefix="URI"]+.

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>
Comment
Documents the JSP page but is not inserted into the response.
JSP Syntax
<%--com ment --%>
XML Syntax
<!--com ment -->
Example

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

Description

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.
3

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

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