SlideShare a Scribd company logo
scriptlet
                                                            Directives                                             Contains a block of scripting code. A JSP page can
                                                                                                                   contain multiple blocks of scripting code.
                                                           page                                                    <% script code %>

                                                           Defines page-wide attributes.                           Example:
                                                           <%@ page attribute="value" ... %>                       <%   String greeting =
                                                                                                                            request.getParameter("Greeting");
                                                           attributes, with default values, are:                        out.println(greeting); %>

JSP Quick Reference Card                                   attribute = language="java" | session="true"
                                                           | contentType=text/html;charset="ISO-8859-1"            expression
                                                           | import="package(s)" | buffer="8kb"
 Basic Syntax                                              | autoflush="true" | isThreadSafe="true"                Defines statements evaluated on the server before
                                                           | info="text_string" | errorPage="relativeURL"          sending the page output to the client.
                                                           | isErrorpage="true" | extends="class_name"
                                                                                                                   <%= expression %>
Default scripting language                                 value = a string literal in single or double quotes.
                                                                                                                   Example:
The scripting language of a JSP page defaults to Java.
Insert the following line in a JSP page to configure the
                                                           include                                                 <%= myVar1%>

page to use JavaScript:                                    Inserts text into a JSP page.
<%@   page language = "javascript" %>
                                                           <%@ include file = "path" ... %>                         Actions
Using white space                                          taglib                                                  jsp:include
White space contained within the template code is          Defines a custom tag library used by a JSP page.        Call one JSP page from another. Upon completion, the
returned to the client as it was entered in the JSP.
                                                           <%@ taglib uri="tagLibraryURI"                          destination page returns control to the calling page.
                                                               prefix="tagPrefix" %>
Quoting attribute values                                                                                           <jsp:include page="path" flush="true"/>
                                                           After the taglib directive, reference the custom tags
Quote attribute values, using either single or double      using the syntax:                                       <jsp:include page="path" flush="true">
quotes, to all JSP elements. For example:                                                                              <jsp:param name="paramName"
                                                           <tagPrefix:tagName>                                         value="paramValue" /> ...
<%@   page contentType = "text/plain" %>                   ...                                                     </jsp:include>
                                                           </tagPrefix:tagName>
Writing comments for the JSP                                                                                       jsp:forward
A JSP comment is not output to the client as part of the
                                                            Scripting Elements                                     Calls one JSP page from another. Execution of the calling
JSP page’s output.                                                                                                 page is terminated by the call.
<%-- Comment string... --%>                                declaration                                             <jsp:forward page="path" />
                                                           Creates page-wide definitions such as variables.
Outputting comments to the client                                                                                  <jsp:forward page="path">
                                                           <%! declaration %>                                          <jsp:param name="paramName"
HTML comments are output to the client.                                                                                value="paramValue" /> ...
                                                           Example:                                                </jsp:forward>
<!-- comments -->
                                                           <%! private String foo = null;
                                                               public String getFoo() {return this.foo;} %>
jsp:plugin                                             jsp:setProperty                                              pageContext
Enables you to invoke an applet on a client browser.   Sets the value of one or more properties in a bean.          The page context for the JSP.
<jsp:plugin                                            <jsp:setProperty name="beanName" prop_expr />                Java type: javax.servlet.jsp.PageContext
    type="bean|applet"
                                                       prop_expr has one of the following forms:
    code="objectCode"                                                                                               request
    codebase="objectCodebase"                          property="*" |
    { align="alignment" }                              property="propertyName"|                                     The client request.
    { archive="archiveList" }                          property="propertyName" param="parameterName"|
    { height="height" }                                property="propertyName" value="propertyValue"                Java type: javax.servlet.HttpServletRequest
    { hspace="hspace" }
    { jreversion="jreversion" }                        jsp:getProperty                                              response
    { name="componentName" }
    { vspace="vspace" }                                Writes the value of a bean property as a string to the out   The response to the client.
    { width="width" }
                                                       object.                                                      Java type: javax.servlet.HttpServletResponse
    { nspluginurl="url" }
    { iepluginurl="url" } >                            <jsp:getProperty name="name"
    { <jsp:params>                                         property="propertyName" />                               session
        { <jsp:param name=" paramName"
            value="paramValue" /> }+                                                                                The session object created for the requesting client.
    </jsp:params> }                                     JSP Objects
    { <jsp:fallback> arbitrary_text                                                                                 Java type: javax.servlet.http.HttpSession
    </jsp:fallback> } >                                See the corresponding Java object type for the available
</jsp:plugin>                                          methods for these objects.
                                                                                                                     Allaire Contact Information
The elements in brackets ({}) are optional.
                                                       application
jsp:useBean                                                                                                         Allaire Web sites
                                                       The servlet context obtained from the servlet
Defines an instance of a Java bean.                    configuration object.                                        Main Allaire Web site:
                                                       Java type: javax.servlet.ServletContext                      www.allaire.com
<jsp:useBean id="name"
    scope="page|request|session|application"                                                                        JRun Development Center:
    typeSpec />                                        config
                                                                                                                    www.allaire.com/developer/jrunreferencedesk/
<jsp:useBean id="name"                                 The ServletConfig object for the JSP page.                   JRun Developer Forum:
    scope="page|request|session|application"
    typeSpec >
                                                       Java type: javax.servlet.ServletConfig                       forums.allaire.com/jrunconf
    body
</jsp:useBean>                                         exception                                                    Allaire technical support
typespec is any one of the following:                  The uncaught exception that resulted in the error page       Telephone support is available Monday through from
class="className" |                                    being invoked.                                               Friday 8 AM to 8 PM Eastern time (except holidays).
class="className" type="typeName" |
                                                       Java type: java.lang.Throwable                               Toll Free: 888.939.2545 (U.S. and Canada)
beanName="beanName" type=" typeName" |
type="typeName"                                                                                                     Telephone: 617.761.2100 (outside U.S. and Canada)
                                                       out
                                                                                                                    JRun is a trademark of Allaire Corporation. All other trademarks are
                                                       An object that writes into a JSP page’s output stream.       property of their respective holder(s.)
                                                                                                                    © 2000 Allaire Corporation. All rights reserved.
                                                       Java type: javax.servlet.jsp.JspWriter                       Part number: AA-JRQRF-RK

More Related Content

PDF
J2EE jsp_01
PDF
Lap trinh web [Slide jsp]
PDF
Introduction to JSP
PPT
3.jsp tutorial
PPTX
ADP- Chapter 3 Implementing Inter-Servlet Communication
PPTX
ADP - Chapter 5 Exploring JavaServer Pages Technology
PPTX
Jsp elements
PPTX
SCWCD : Java server pages CHAP : 9
J2EE jsp_01
Lap trinh web [Slide jsp]
Introduction to JSP
3.jsp tutorial
ADP- Chapter 3 Implementing Inter-Servlet Communication
ADP - Chapter 5 Exploring JavaServer Pages Technology
Jsp elements
SCWCD : Java server pages CHAP : 9

What's hot (20)

PDF
Java Web Programming [5/9] : EL, JSTL and Custom Tags
PDF
Java Web Programming [8/9] : JSF and AJAX
PDF
Java Web Programming [4/9] : JSP Basic
PPTX
Implicit objects advance Java
PPTX
PPTX
Jsp presentation
PPT
Jsp slides
PPT
Jsp Slides
PPT
KMUTNB - Internet Programming 5/7
PDF
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
DOCX
PDF
PPTX
Sightly - Part 2
PPTX
Implicit object.pptx
PPTX
Java Server Pages
PDF
Java Web Programming [7/9] : Struts2 Basics
PDF
Java Web Programming [6/9] : MVC
PPTX
Java server pages
PPTX
Servlet and jsp interview questions
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [4/9] : JSP Basic
Implicit objects advance Java
Jsp presentation
Jsp slides
Jsp Slides
KMUTNB - Internet Programming 5/7
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
Sightly - Part 2
Implicit object.pptx
Java Server Pages
Java Web Programming [7/9] : Struts2 Basics
Java Web Programming [6/9] : MVC
Java server pages
Servlet and jsp interview questions
Ad

Viewers also liked (6)

PPT
Weston Electricity
PPT
Jesses Electricity
PPTX
Nature & Background of Electricity
PPTX
Electricity saving in Buildings using LEDs Lightbulbs
PPTX
Electricity
PDF
K to 12 - Grade 8 Science Learner Module
Weston Electricity
Jesses Electricity
Nature & Background of Electricity
Electricity saving in Buildings using LEDs Lightbulbs
Electricity
K to 12 - Grade 8 Science Learner Module
Ad

Similar to Jsp quick reference card (20)

PDF
JSP Syntax_1
PDF
Card12
TXT
Jsp Notes
PPTX
JSP AND XML USING JAVA WITH GET AND POST METHODS
PPS
Jsp element
PDF
JavaServer Pages
PPTX
JSP.pptx programming guide for beginners and experts
PPTX
Introduction to JSP
PPT
Jsp slides
PPTX
Java server pages
PDF
jsp, javaserver pages, Card20
PPTX
Introduction to JSP.pptx
PPTX
JSP_Complete_Guide_With_Step_By_Step_solution
PPT
KMUTNB - Internet Programming 5/7
PPTX
JSP - Java Server Page
PPT
Server side development on java server pages
PPT
DOC
Jsp advance part i
JSP Syntax_1
Card12
Jsp Notes
JSP AND XML USING JAVA WITH GET AND POST METHODS
Jsp element
JavaServer Pages
JSP.pptx programming guide for beginners and experts
Introduction to JSP
Jsp slides
Java server pages
jsp, javaserver pages, Card20
Introduction to JSP.pptx
JSP_Complete_Guide_With_Step_By_Step_solution
KMUTNB - Internet Programming 5/7
JSP - Java Server Page
Server side development on java server pages
Jsp advance part i

More from JavaEE Trainers (9)

PDF
Introduction tomcat7 servlet3
PDF
Introduction to java servlet 3.0 api javaone 2009
PDF
Introduction to java servlet 3.0 api javaone 2008
PPT
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
PPT
Servlet/JSP course chapter 1: Introduction to servlets
PPT
Introduction to the Servlet / JSP course
PPT
Struts2 course chapter 2: installation and configuration
PPT
Struts2 course chapter 1: Evolution of Web Applications
PPT
Struts2 Course: Introduction
Introduction tomcat7 servlet3
Introduction to java servlet 3.0 api javaone 2009
Introduction to java servlet 3.0 api javaone 2008
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
Servlet/JSP course chapter 1: Introduction to servlets
Introduction to the Servlet / JSP course
Struts2 course chapter 2: installation and configuration
Struts2 course chapter 1: Evolution of Web Applications
Struts2 Course: Introduction

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
KodekX | Application Modernization Development
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
Unlocking AI with Model Context Protocol (MCP)
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectral efficient network and resource selection model in 5G networks
Programs and apps: productivity, graphics, security and other tools
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
NewMind AI Weekly Chronicles - August'25 Week I
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Big Data Technologies - Introduction.pptx
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
KodekX | Application Modernization Development
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Teaching material agriculture food technology
Approach and Philosophy of On baking technology

Jsp quick reference card

  • 1. scriptlet Directives Contains a block of scripting code. A JSP page can contain multiple blocks of scripting code. page <% script code %> Defines page-wide attributes. Example: <%@ page attribute="value" ... %> <% String greeting = request.getParameter("Greeting"); attributes, with default values, are: out.println(greeting); %> JSP Quick Reference Card attribute = language="java" | session="true" | contentType=text/html;charset="ISO-8859-1" expression | import="package(s)" | buffer="8kb" Basic Syntax | autoflush="true" | isThreadSafe="true" Defines statements evaluated on the server before | info="text_string" | errorPage="relativeURL" sending the page output to the client. | isErrorpage="true" | extends="class_name" <%= expression %> Default scripting language value = a string literal in single or double quotes. Example: The scripting language of a JSP page defaults to Java. Insert the following line in a JSP page to configure the include <%= myVar1%> page to use JavaScript: Inserts text into a JSP page. <%@ page language = "javascript" %> <%@ include file = "path" ... %> Actions Using white space taglib jsp:include White space contained within the template code is Defines a custom tag library used by a JSP page. Call one JSP page from another. Upon completion, the returned to the client as it was entered in the JSP. <%@ taglib uri="tagLibraryURI" destination page returns control to the calling page. prefix="tagPrefix" %> Quoting attribute values <jsp:include page="path" flush="true"/> After the taglib directive, reference the custom tags Quote attribute values, using either single or double using the syntax: <jsp:include page="path" flush="true"> quotes, to all JSP elements. For example: <jsp:param name="paramName" <tagPrefix:tagName> value="paramValue" /> ... <%@ page contentType = "text/plain" %> ... </jsp:include> </tagPrefix:tagName> Writing comments for the JSP jsp:forward A JSP comment is not output to the client as part of the Scripting Elements Calls one JSP page from another. Execution of the calling JSP page’s output. page is terminated by the call. <%-- Comment string... --%> declaration <jsp:forward page="path" /> Creates page-wide definitions such as variables. Outputting comments to the client <jsp:forward page="path"> <%! declaration %> <jsp:param name="paramName" HTML comments are output to the client. value="paramValue" /> ... Example: </jsp:forward> <!-- comments --> <%! private String foo = null; public String getFoo() {return this.foo;} %>
  • 2. jsp:plugin jsp:setProperty pageContext Enables you to invoke an applet on a client browser. Sets the value of one or more properties in a bean. The page context for the JSP. <jsp:plugin <jsp:setProperty name="beanName" prop_expr /> Java type: javax.servlet.jsp.PageContext type="bean|applet" prop_expr has one of the following forms: code="objectCode" request codebase="objectCodebase" property="*" | { align="alignment" } property="propertyName"| The client request. { archive="archiveList" } property="propertyName" param="parameterName"| { height="height" } property="propertyName" value="propertyValue" Java type: javax.servlet.HttpServletRequest { hspace="hspace" } { jreversion="jreversion" } jsp:getProperty response { name="componentName" } { vspace="vspace" } Writes the value of a bean property as a string to the out The response to the client. { width="width" } object. Java type: javax.servlet.HttpServletResponse { nspluginurl="url" } { iepluginurl="url" } > <jsp:getProperty name="name" { <jsp:params> property="propertyName" /> session { <jsp:param name=" paramName" value="paramValue" /> }+ The session object created for the requesting client. </jsp:params> } JSP Objects { <jsp:fallback> arbitrary_text Java type: javax.servlet.http.HttpSession </jsp:fallback> } > See the corresponding Java object type for the available </jsp:plugin> methods for these objects. Allaire Contact Information The elements in brackets ({}) are optional. application jsp:useBean Allaire Web sites The servlet context obtained from the servlet Defines an instance of a Java bean. configuration object. Main Allaire Web site: Java type: javax.servlet.ServletContext www.allaire.com <jsp:useBean id="name" scope="page|request|session|application" JRun Development Center: typeSpec /> config www.allaire.com/developer/jrunreferencedesk/ <jsp:useBean id="name" The ServletConfig object for the JSP page. JRun Developer Forum: scope="page|request|session|application" typeSpec > Java type: javax.servlet.ServletConfig forums.allaire.com/jrunconf body </jsp:useBean> exception Allaire technical support typespec is any one of the following: The uncaught exception that resulted in the error page Telephone support is available Monday through from class="className" | being invoked. Friday 8 AM to 8 PM Eastern time (except holidays). class="className" type="typeName" | Java type: java.lang.Throwable Toll Free: 888.939.2545 (U.S. and Canada) beanName="beanName" type=" typeName" | type="typeName" Telephone: 617.761.2100 (outside U.S. and Canada) out JRun is a trademark of Allaire Corporation. All other trademarks are An object that writes into a JSP page’s output stream. property of their respective holder(s.) © 2000 Allaire Corporation. All rights reserved. Java type: javax.servlet.jsp.JspWriter Part number: AA-JRQRF-RK