Java Server Page

Implicit Objects

Directives

Scripting Elements

JSP Declarations

JSP Scriptlets

JSP Expression

response

include

taglib

page

pageContext

request

session

<%= Java Expression %>

application

out

Used to insert Java values directly into the output.

config

page

Performed at run-time and has full access to information about the request.

Import classes, customize the servlet superclass, and the like

This is the HttpServletRequest object associated with the request.

Define methods or fields that get inserted into the main body of the servlet class

Include files at the time the JSP page is translated into a servlet

This is the HttpServletResponse object associated with the response to the client.

<%! Java Code %>

Define one or more of the following case-sensitive attributes

This is the ServletContext object associated with the application context.

This is the ServletConfig object associated with the page.

This encapsulates use of server-specific features like higher performance JspWriters.

<%@ page attribute = "value" %>

This is the HttpSession object associated with the request.

do not generate any output. So usually used in conjunction with JSP expressions or scriptlets.

Have access to the same automatically defined
variables as expressions.

Example : <%@ page import="java.util.*" %>

This is the PrintWriter object used to send output to the client.

Let you insert arbitrary code into the servlet method that will be built to generate page.

<% Java Code; %>

This is simply a synonym for this, and is used to call the methods defined by the translated servlet class.

<%@ include file="relative url" %>

For including custom tag libraries

Declares that JSP page uses a set of custom tags, identifies the location of the library, and provides means for identifying the custom tags in JSP page

<%@ taglib uri="uri" prefix = "prefixOfTag" >

<%@ page ... %>

<%@ include ... %>

<%@ taglib ... %>

URL specified is normally interpreted relative to the JSP page that refers to it

Action

Common Attributes

Id Attribute uniquely identifies the Action element, and allows the action to be referenced inside the JSP page.

Scope Attribute identifies the lifecycle of the Action element. It also determines the lifespan of the object associated with the id.

Tags

jsp:useBean

jsp:setProperty

jsp:include

jsp:getProperty

jsp:forward

jsp:plugin

jsp:param

jsp:fallback

Forwards the request and response to another resource.

Includes another resource.

Creates or locates bean object.

Sets the value of property in bean object.

Prints the value of property of the bean.

Embeds another components such as applet.

Sets the parameter value. It is used in forward and include mostly.

Can be used to print the message if plugin is working. It is used in jsp:plugin.

4 possible values

request

session

page

application

These actions use constructs in XML syntax to control the behavior of the servlet engine.

call implicit objects

request

respoonse

session

out