JSP Notes
JSP Notes
Java Java
HTML code Java code
Servlet JSP
1. Page directive: -
It is written as <%@page %>
→It is used for giving information to current JSP page.
Attributes of current JSP page: -
a. language: -
→This attribute tells about the language which is used and which
is translated late.
→value of this attribute is always java.
language=”java”
b. contentType: -
→this attribute decide what type of response need to be given.
contentType =”text/html”
c. pageEncoding: -
→this is about the character set included in the current page.
d. Import: -
→it is used to import library file.
e. errorPage: -
→This defines the destination page to which we need to redirect if
any error occurs in the current page.
f. isErrorPage: -
→This is used to indicate the current page is handling the error.
isErrorPage =”true”
g. extend: -
→by this attribute we can extend any class.
extends = ”com.example.xyz”
2.Include: -
It is used to include any jsp or html page to the current page
<%@ include=””%>
3.taglib: -
It is used for including 3rd party jsp tags (spring)
<%@taglib
prefix=”form” url=”http://www.springframework.org/tags/form”
%>
Implicit Objects: -
In JSP there are predefined words which represent the objects.
request → HttpServletRequest
response → HttpServletResponse
session → HttpSession
exception → Throwable
out → PrintWriter (JspWriter)
config → ServletConfig
application → ServletContext
page → Object
pageContext → PageContext