JSP Implicit Objects CS 422 Dick Steflik.

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialitica in Informatica – Università di Trento.
Advertisements

7 Copyright © 2005, Oracle. All rights reserved. Maintaining State in J2EE Applications.
1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.
1 Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun.
Michael Brockway Application Integration JavaServer Pages l Introduction & Overview l Implicit Objects l Scripting l Standard Actions l Directives l References.
Authentication and Security Joshua Scotton.  Sessions  Login and Authentication.
An introduction to Java Servlet Programming
Servlets CS-328 Dick Steflik. What is a servlet A Java application run on a thread of the webserver in response to an HTTP GET or POST request. The servlet.
Servlet Session Tracking II Session API All material and examples are from
/ department of mathematics and computer sciencedepartment of mathematics and computer science / architecture of information systems.
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
All You Ever Wanted To Know About Servlets But Were Afraid to Ask.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
Java Servlet Technology. Introduction Servlets are Java programs that run on a Web server, handle HTTP requests and build Web pages Servlet specification.
Servlets Pranav Maydeo. What is a Servlet ? Servlets are modules of Java code that run in a server application to answer client requests. Servlets are.
Li Tak Sing COMPS311F. Static attributes in Servlets Since Servlets are also Java classes, you can also use static attributes to store values that can.
Session tracking There are a number of problems that arise from the fact that HTTP is a "stateless" protocol. In particular, when you are doing on- line.
16-Oct-15 JSP Implicit Objects. 2 JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer.
Session Tracking - 2 Lec 32. Last Lecture Review  Session Tracking – why?  Need to store state – typical solutions Cookies – already learned URL Rewriting.
Web Application Development * These slides have been adapted and modified from CoreServlets course material (Marty Hall) and LUMS cs391 (Umair Javed).
Chapter 9 Session Tracking. Session Tracking Basics Accessing the session object associated with the current request: Call request.getSession to get an.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Session Management.
CSC 2720 Building Web Applications JavaServer Pages (JSP) The Basics.
JSP Implicit Objects JSP Implicit objects are created by the web container. These implicit objects are Java objects that implement interfaces in the Servlet.
All You Ever Wanted To Know About Servlets But Were Afraid to Ask.
JAVA Sessions 1. What is Session Tracking? There are a number of problems that arise from the fact that HTTP is a "stateless" protocol. In particular,
Chapter 11 Invoking Java Code with JSP Scripting Elements.
Slides © Marty Hall, book © Sun Microsystems Press 1 Session Tracking Core Servlets & JSP book: More.
J2EE T ECHNOLOGIES These are the technologies required to build large scale distributed applications, can be divided into – Component Technologies eg.
©SoftMooreSlide 1 Session Tracking with Servlets.
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
MVC for Servlets 26-Apr-17.
CSC 2720 Building Web Applications Managing Users' States – Cookies, URL-Rewriting, Hidden Fields and Session Management APIs.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
1 Chapter 27 JavaServer Page. 2 Objectives F To know what is a JSP page is processed (§27.2). F To comprehend how a JSP page is processed (§27.3). F To.
Session Tracking Parts of this presentation was provided by SSE.
Net-centric Computing Servlets & JSP. Lecture Outline  Tracking Sessions  Cookies  Examples  JSP  Differences between JSP and Servlets  JSP Constructs.
Servlets.
Java Servlets By: Tejashri Udavant..
Sessions Many interactive Web sites spread user data entry out over several pages: Ex: add items to cart, enter shipping information, enter billing information.
Java Servlets.
Pre-assessment Questions
Pre-assessment Questions
Introduction to JSP Java Server Pages
Servlet.
Servlet API and Lifecycle
Sessions.
Java Servlets II: Session Tracking
SESSION TRACKING.
Chapter 26 Servlets.
Servlets and Java Server Pages
CS320 Web and Internet Programming Cookies and Session Tracking
Introduction to Servlets
Servlets.
All You Ever Wanted To Know About Servlets
Handling State in Web Applications
Servlet APIs Every servlet must implement javax.servlet.Servlet interface Most servlets implement the interface by extending one of these classes javax.servlet.GenericServlet.
CS3220 Web and Internet Programming Cookies and Session Tracking
Objectives In this lesson you will learn about: Need for servlets
Cookies Cookies are small bits of textual information that a Web server sends to a browser and that the browser returns unchanged when later visiting the.
Sessions Many interactive Web sites spread user data entry out over several pages: Ex: add items to cart, enter shipping information, enter billing information.
Web Search Interfaces.
MVC for Servlets 23-Feb-19.
Knowledge Byte In this section, you will learn about:
CS3220 Web and Internet Programming Cookies and Session Tracking
MVC for Servlets 29-Apr-19.
Pre-assessment Questions
MVC for Servlets 5-Jul-19.
Servlet Session Tracking: Session API
Presentation transcript:

JSP Implicit Objects CS 422 Dick Steflik

Implicit Objects Objects created by the servlet container application session request response exception out Config pageContext page

Application Object Used to share data between all of the pages that make up an application All users share the Application Object Can be accessed from any JSP in the application via the ServletContext javax.servlet.http.ServletContext

Application Object Methods getAttribute(String name) getAttributeNames setAttribute(String objName, Object object) removeAttribute(String objName) getMajorVersion() getMinorVersion() getServerInfo() getInitParameter(String name) getInitParameterNames getResourceAsStream(Path) log(Message)

Sessions A session is a concept that represents a series of HTTP requests and responses between a specific browser and a specific server. Sessions are managed by the server Created by the server when the first request is received from a browser on a new host the server starts the session and assigns it an ID. The ID is sent to the browser as a cookie and remembered by the server

Sessions (more) The server creates a Session object that contains the attributes: Creation Time ID Last Time Accessed Maximum Inactive Time allowed

HTTPSession Interface getAttribute() – returns the object associated with the specified key string getAttributeNames() – returns an enumeration of the key strings in the session getCreationTime() – returns the time the session was created; millsecs past midnight since Jan 1, 1970 GMT getID() – returns the session ID as a string getLastAccessedTime() – returns thelast time the client sent a request for this session getMaxInactiveInterval() – returns the maximun amount of time that the servlet container between client requests before timing out the session setAttribute() – associates an object with a key string in the session removeAttribute() – remove an attribute from the session setMaxInactiveInterval() – set the time in seconds allowed between client requests isNew() – true if a new session, false otherwise

request Object Javax.servlet. http.httpservletrequest. The object request is of type Javax.servlet.http.httpservletrequest. This denotes the data included with the HTTP Request. The client makes a request that is then passed to the server. The requested object is used to take the value from client’s web browser and pass it to the server. This is performed using HTTP request like headers, cookies and arguments.

response Object Javax.servlet.http.HttpServletResponse The HTTP Response data. The result or the information that fulfills an Http request The object response is of type javax.servlet.http. >httpservletresponse. Generally, the object response is used with cookies. The response object is used to build the HTTP response header

pageContext Object Javax.servlet.jsp.pagecontext Used to access page attributes and also to access all the namespaces associated with a JSP page.

Out Object The Output stream in the context of page. The class or the interface name of the Out object is jsp.JspWriter. The Out object is written: Javax.servlet.jsp.JspWriter

config Object This is used to get information regarding the Servlet configuration The class or the interface name of the Config object is ServletConfig. The object Config is written Javax.servlet.http.ServletConfig

page Object The Page object denotes the JSP page Used for calling any instance of a Page's servlet. The class or the interface name of the Page object is jsp.HttpJspPage. The Page object is written: Java.lang.Object

Passing Values from Page to Page Put values in the session object Put the values in the application object Put values at the end of the URL