SlideShare a Scribd company logo
JAVASERVER PAGES™ (JSP) SYNTAX
                                                                                              JSP 1.1 BETA
Element             Description                                   JSP Syntax

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

                                                                  plain text = required      bold = default            italics = user-defined    | = or
                                                                  [ ] = optional             { } = required choice     ... = list of items       + = can repeat

HTML Comment        Creates a comment that is sent to the         <!-- comment [ <%= expression %> ] -->
                    client in the viewable page source.

Hidden Comment      Documents the JSP file, but is not sent to    <%-- comment --%>
                    the client.



Declaration         Declares variables or methods valid in        <%! declaration; [ declaration; ]+ ... %>
                    the page scripting language.



Expression          Contains an expression valid in the page      <%= expression %>
                    scripting language.



Scriptlet           Contains a code fragment valid in the         <% code fragment of one or more lines %>
                    page scripting language.



Include Directive   Includes a static file, parsing the file’s    <%@ include file="relativeURL" %>
                    JSP elements.



Page Directive      Defines attributes that apply to an entire    <%@ page [ language="java" ] [ extends="package.class" ] [ import="{package.class | package.*} , ... " ]
                    JSP page.                                              [ 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" ] %>



Taglib Directive    Defines a tag library and prefix for the      <%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %>
                    custom tags used in the JSP page.
                                                                  custom tag:
                                                                  <tagPrefix:name attribute="value"+ ... />
                                                                  <tagPrefix:name attribute="value"+ ... >  other tags       </tagPrefix:name>




                                                                                                                                         More information:
                                                                                                                                http://java.sun.com/products/jsp/
JAVASERVER PAGES (JSP) SYNTAX
Element                                    Description                                                                                  JSP Syntax

<jsp:forward>                              Forwards a client request to an HTML                                                         <jsp:forward page="{relativeURL | <%= expression %> }"
                                           file, JSP file, or servlet for processing.                                                      { /> |
                                                                                                                                                 [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+
                                                                                                                                                  </jsp:forward> }

<jsp:getProperty>                          Gets the value of a Bean property so                                                         <jsp:getProperty name="beanInstanceName" property="propertyName" />
                                           that you can display it in a result page.

<jsp:include>                              Includes a static file or sends a request                                                    <jsp:include page="{relativeURL | <%= expression %>}" flush="true"
                                           to a dynamic file.                                                                              { /> |
                                                                                                                                                 [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+
                                                                                                                                                  </jsp:include> }

<jsp:plugin>                               Downloads plug-in software to the Web                                                        <jsp:plugin type="bean|applet" code="classFileName" codebase="classFileDirectoryName"
                                           browser to execute an applet or Bean.                                                           [ name="instanceName" ] [ archive="URIToArchive, ..." ] [ align="bottom|top|middle|left|right" ]
                                                                                                                                           [ height="displayPixels" ] [ width="displayPixels" ] [ hspace="leftRightPixels" ] [ vspace="topBottomPixels" ]
                                                                                                                                           [ jreversion="JREVersionNumber | 1.1" ] [ nspluginurl="URLToPlugin" ] [ iepluginurl="URLToPlugin" ] >

                                                                                                                                                   [ <jsp:params> [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+
                                                                                                                                                   </jsp:params> ]
                                                                                                                                                   [ <jsp:fallback> text message for user </jsp:fallback> ]

                                                                                                                                        </jsp:plugin>

<jsp:setProperty>                          Sets a property value or values in a                                                         <jsp:setProperty name="beanInstanceName"
                                           Bean.                                                                                           { property="*" | property="propertyName" [ param="parameterName" ] |
                                                                                                                                             property="propertyName" value="{string | <%= expression %>}" } />

<jsp:useBean>                              Locates or instantiates a Bean with a                                                        <jsp:useBean id="beanInstanceName" scope="page|request|session|application"
                                           specific name and scope.                                                                        { class="package.class" [ type="package.class" ] | type="package.class" |
                                                                                                                                              beanName="{package.class | <%= expression %>}" type="package.class" }
                                                                                                                                           { /> | >     other elements </jsp:useBean> }

Implicit Objects                           Type                                                                                         Scope                                                             Some Useful Methods (see class or interface for others)

 request                                   Subclass of javax.servlet.ServletRequest                                                     Request                                                           getAttribute, getParameter, getParameterNames, getParameterValues

 response                                  Subclass of javax.servlet.ServletResponse                                                    Page                                                              Not typically used by JSP page authors

 pageContext                               javax.servlet.jsp.PageContext                                                                Page                                                              findAttribute, getAttribute, getAttributesScope, getAttributeNamesInScope

 session                                   javax.servlet.http.HttpSession                                                               Session                                                           getId, getValue, getValueNames, putValue

 application                               javax.servlet.ServletContext                                                                 Application                                                       getMimeType, getRealPath

  out                                      javax.servlet.jsp.JspWriter                                                                  Page                                                              clear, clearBuffer, flush, getBufferSize, getRemaining

  config                                   javax.servlet.ServletConfig                                                                  Page                                                              getInitParameter, getInitParameterNames

  page                                     java.lang.Object                                                                             Page                                                              Not typically used by JSP page authors

  exception                                java.lang.Throwable                                                                          Page                                                              getMessage, getLocalizedMessage, printStackTrace, toString

 © 1999 Sun Microsystems, Inc. All rights reserved. Sun, Sun Microsystems, the Sun logo, Java, the Java Coffee Cup logo, JavaServer Pages, and the Duke logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.   Is this heaven? No, it’s the JavaServer Pages technology.   Printed in USA 11/99

More Related Content

What's hot

Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
ramakesavan
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
Samuel Santos
 
Stripes Framework
Stripes FrameworkStripes Framework
Stripes Framework
Johannes Carlén
 
Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1
Michał Orman
 
Intro To Sap Netweaver Java
Intro To Sap Netweaver JavaIntro To Sap Netweaver Java
Intro To Sap Netweaver Java
Leland Bartlett
 
Using the Features API
Using the Features APIUsing the Features API
Using the Features API
cgmonroe
 
Basic JSTL
Basic JSTLBasic JSTL
Basic JSTL
corneliuskoo
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf Conference
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
Arun Gupta
 
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
Content-Driven Web Applications with Magnolia CMS and Ruby on RailsContent-Driven Web Applications with Magnolia CMS and Ruby on Rails
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
bkraft
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in Rails
Seungkyun Nam
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
phuphax
 
Javatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparisonJavatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparison
Jini Lee
 
Cake php 1.2-cheatsheet
Cake php 1.2-cheatsheetCake php 1.2-cheatsheet
Cake php 1.2-cheatsheet
PrinceGuru MS
 
Java beans
Java beansJava beans
Java beans
Bipin Bedi
 
Modularity and Layered Data Model
Modularity and Layered Data ModelModularity and Layered Data Model
Modularity and Layered Data Model
Attila Jenei
 
Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010
Plataformatec
 
AngularJs-training
AngularJs-trainingAngularJs-training
AngularJs-training
Pratchaya Suputsopon
 
Polymer
PolymerPolymer
Polymer
Cyril Balit
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
hugowetterberg
 

What's hot (20)

Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
 
Stripes Framework
Stripes FrameworkStripes Framework
Stripes Framework
 
Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1
 
Intro To Sap Netweaver Java
Intro To Sap Netweaver JavaIntro To Sap Netweaver Java
Intro To Sap Netweaver Java
 
Using the Features API
Using the Features APIUsing the Features API
Using the Features API
 
Basic JSTL
Basic JSTLBasic JSTL
Basic JSTL
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
 
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
Content-Driven Web Applications with Magnolia CMS and Ruby on RailsContent-Driven Web Applications with Magnolia CMS and Ruby on Rails
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in Rails
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 
Javatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparisonJavatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparison
 
Cake php 1.2-cheatsheet
Cake php 1.2-cheatsheetCake php 1.2-cheatsheet
Cake php 1.2-cheatsheet
 
Java beans
Java beansJava beans
Java beans
 
Modularity and Layered Data Model
Modularity and Layered Data ModelModularity and Layered Data Model
Modularity and Layered Data Model
 
Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010
 
AngularJs-training
AngularJs-trainingAngularJs-training
AngularJs-training
 
Polymer
PolymerPolymer
Polymer
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
 

Similar to JSP Syntax_1

Jsp quick reference card
Jsp quick reference cardJsp quick reference card
Jsp quick reference card
JavaEE Trainers
 
Introduction to JSP
Introduction to JSPIntroduction to JSP
Introduction to JSP
Geethu Mohan
 
Introduction to JSP.pptx
Introduction to JSP.pptxIntroduction to JSP.pptx
Introduction to JSP.pptx
ManishaPatil932723
 
ADP - Chapter 5 Exploring JavaServer Pages Technology
ADP - Chapter 5 Exploring JavaServer Pages TechnologyADP - Chapter 5 Exploring JavaServer Pages Technology
ADP - Chapter 5 Exploring JavaServer Pages Technology
Riza Nurman
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
Biswabrata Banerjee
 
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp  - Giáo trình Bách Khoa AptechSession 5 : intro to jsp  - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
MasterCode.vn
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
Asya Dudnik
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
Asya Dudnik
 
Card12
Card12Card12
Card12
guestd097bc
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]
Tri Nguyen
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Fahad Golra
 
JSP AND XML USING JAVA WITH GET AND POST METHODS
JSP AND XML USING JAVA WITH GET AND POST METHODSJSP AND XML USING JAVA WITH GET AND POST METHODS
JSP AND XML USING JAVA WITH GET AND POST METHODS
bharathiv53
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
Vipin Yadav
 
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component DevelopmentEVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
Evolve The Adobe Digital Marketing Community
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Rami Nayan
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
phuphax
 
Jsp element
Jsp elementJsp element
Jsp element
kamal kotecha
 
Jsp servlets
Jsp servletsJsp servlets
Jsp servlets
Rajavel Dhandabani
 
JSP.pptx
JSP.pptxJSP.pptx
JSP.pptx
NishaRohit6
 
Jsp1
Jsp1Jsp1

Similar to JSP Syntax_1 (20)

Jsp quick reference card
Jsp quick reference cardJsp quick reference card
Jsp quick reference card
 
Introduction to JSP
Introduction to JSPIntroduction to JSP
Introduction to JSP
 
Introduction to JSP.pptx
Introduction to JSP.pptxIntroduction to JSP.pptx
Introduction to JSP.pptx
 
ADP - Chapter 5 Exploring JavaServer Pages Technology
ADP - Chapter 5 Exploring JavaServer Pages TechnologyADP - Chapter 5 Exploring JavaServer Pages Technology
ADP - Chapter 5 Exploring JavaServer Pages Technology
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp  - Giáo trình Bách Khoa AptechSession 5 : intro to jsp  - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
 
Card12
Card12Card12
Card12
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
 
JSP AND XML USING JAVA WITH GET AND POST METHODS
JSP AND XML USING JAVA WITH GET AND POST METHODSJSP AND XML USING JAVA WITH GET AND POST METHODS
JSP AND XML USING JAVA WITH GET AND POST METHODS
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component DevelopmentEVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
EVOLVE'14 | Enhance | Gabriel Walt | Sightly Component Development
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 
Jsp element
Jsp elementJsp element
Jsp element
 
Jsp servlets
Jsp servletsJsp servlets
Jsp servlets
 
JSP.pptx
JSP.pptxJSP.pptx
JSP.pptx
 
Jsp1
Jsp1Jsp1
Jsp1
 

More from brecke

jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2
brecke
 
jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1
brecke
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
brecke
 
git-cheat-sheet
git-cheat-sheetgit-cheat-sheet
git-cheat-sheet
brecke
 
Rails_3_Cheat_Sheets
Rails_3_Cheat_SheetsRails_3_Cheat_Sheets
Rails_3_Cheat_Sheetsbrecke
 
rails-migrations_1
rails-migrations_1rails-migrations_1
rails-migrations_1
brecke
 
jQuery1.2.cheatsheet.v1.0_1
jQuery1.2.cheatsheet.v1.0_1jQuery1.2.cheatsheet.v1.0_1
jQuery1.2.cheatsheet.v1.0_1
brecke
 
jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2
brecke
 
jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1
brecke
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
brecke
 
git-cheat-sheet
git-cheat-sheetgit-cheat-sheet
git-cheat-sheet
brecke
 

More from brecke (11)

jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2
 
jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 
git-cheat-sheet
git-cheat-sheetgit-cheat-sheet
git-cheat-sheet
 
Rails_3_Cheat_Sheets
Rails_3_Cheat_SheetsRails_3_Cheat_Sheets
Rails_3_Cheat_Sheets
 
rails-migrations_1
rails-migrations_1rails-migrations_1
rails-migrations_1
 
jQuery1.2.cheatsheet.v1.0_1
jQuery1.2.cheatsheet.v1.0_1jQuery1.2.cheatsheet.v1.0_1
jQuery1.2.cheatsheet.v1.0_1
 
jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2jQuery-Visual-Cheat-Sheet-1.4.2
jQuery-Visual-Cheat-Sheet-1.4.2
 
jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1jQuery Visual Cheat Sheet (by WOORK)_1
jQuery Visual Cheat Sheet (by WOORK)_1
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 
git-cheat-sheet
git-cheat-sheetgit-cheat-sheet
git-cheat-sheet
 

JSP Syntax_1

  • 1. JAVASERVER PAGES™ (JSP) SYNTAX JSP 1.1 BETA Element Description JSP Syntax Legend 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. plain text = required bold = default italics = user-defined | = or [ ] = optional { } = required choice ... = list of items + = can repeat HTML Comment Creates a comment that is sent to the <!-- comment [ <%= expression %> ] --> client in the viewable page source. Hidden Comment Documents the JSP file, but is not sent to <%-- comment --%> the client. Declaration Declares variables or methods valid in <%! declaration; [ declaration; ]+ ... %> the page scripting language. Expression Contains an expression valid in the page <%= expression %> scripting language. Scriptlet Contains a code fragment valid in the <% code fragment of one or more lines %> page scripting language. Include Directive Includes a static file, parsing the file’s <%@ include file="relativeURL" %> JSP elements. Page Directive Defines attributes that apply to an entire <%@ page [ language="java" ] [ extends="package.class" ] [ import="{package.class | package.*} , ... " ] JSP page. [ 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" ] %> Taglib Directive Defines a tag library and prefix for the <%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %> custom tags used in the JSP page. custom tag: <tagPrefix:name attribute="value"+ ... /> <tagPrefix:name attribute="value"+ ... > other tags </tagPrefix:name> More information: http://java.sun.com/products/jsp/
  • 2. JAVASERVER PAGES (JSP) SYNTAX Element Description JSP Syntax <jsp:forward> Forwards a client request to an HTML <jsp:forward page="{relativeURL | <%= expression %> }" file, JSP file, or servlet for processing. { /> | [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+ </jsp:forward> } <jsp:getProperty> Gets the value of a Bean property so <jsp:getProperty name="beanInstanceName" property="propertyName" /> that you can display it in a result page. <jsp:include> Includes a static file or sends a request <jsp:include page="{relativeURL | <%= expression %>}" flush="true" to a dynamic file. { /> | [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+ </jsp:include> } <jsp:plugin> Downloads plug-in software to the Web <jsp:plugin type="bean|applet" code="classFileName" codebase="classFileDirectoryName" browser to execute an applet or Bean. [ name="instanceName" ] [ archive="URIToArchive, ..." ] [ align="bottom|top|middle|left|right" ] [ height="displayPixels" ] [ width="displayPixels" ] [ hspace="leftRightPixels" ] [ vspace="topBottomPixels" ] [ jreversion="JREVersionNumber | 1.1" ] [ nspluginurl="URLToPlugin" ] [ iepluginurl="URLToPlugin" ] > [ <jsp:params> [ <jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+ </jsp:params> ] [ <jsp:fallback> text message for user </jsp:fallback> ] </jsp:plugin> <jsp:setProperty> Sets a property value or values in a <jsp:setProperty name="beanInstanceName" Bean. { property="*" | property="propertyName" [ param="parameterName" ] | property="propertyName" value="{string | <%= expression %>}" } /> <jsp:useBean> Locates or instantiates a Bean with a <jsp:useBean id="beanInstanceName" scope="page|request|session|application" specific name and scope. { class="package.class" [ type="package.class" ] | type="package.class" | beanName="{package.class | <%= expression %>}" type="package.class" } { /> | > other elements </jsp:useBean> } Implicit Objects Type Scope Some Useful Methods (see class or interface for others) request Subclass of javax.servlet.ServletRequest Request getAttribute, getParameter, getParameterNames, getParameterValues response Subclass of javax.servlet.ServletResponse Page Not typically used by JSP page authors pageContext javax.servlet.jsp.PageContext Page findAttribute, getAttribute, getAttributesScope, getAttributeNamesInScope session javax.servlet.http.HttpSession Session getId, getValue, getValueNames, putValue application javax.servlet.ServletContext Application getMimeType, getRealPath out javax.servlet.jsp.JspWriter Page clear, clearBuffer, flush, getBufferSize, getRemaining config javax.servlet.ServletConfig Page getInitParameter, getInitParameterNames page java.lang.Object Page Not typically used by JSP page authors exception java.lang.Throwable Page getMessage, getLocalizedMessage, printStackTrace, toString © 1999 Sun Microsystems, Inc. All rights reserved. Sun, Sun Microsystems, the Sun logo, Java, the Java Coffee Cup logo, JavaServer Pages, and the Duke logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Is this heaven? No, it’s the JavaServer Pages technology. Printed in USA 11/99