Introduction to Web Application Technologies
CGI Programs on the Web Server
What is servlet?
Jobs of servlet
Advantages over CGI
Why pages are build dynamically?
Servlet container
Installation & configuration
- Type 1: Integration of Tomcat server and eclipse
- Type 2: Java Servlet
Servlet Sample Example
Servlet Overview And Architecture
- Servlet Life cycle/Single Thread Model
- Interface Servlet
- HttpServlet Class
- HttpServletRequest, HttpServletResponse
In this presentation I will go through latest features being added in Spring 3.1/3.2 one more time and also will try to look behind the scene on what new features are comming in Spring 4 which should be released at the end of this year.
Java EE 8 Web Frameworks: A Look at JSF vs MVCJosh Juneau
This session provides an overview of both the JSF and MVC 1.0 frameworks. The frameworks are then compared to each other. Finally, JSF 2.3 upcoming features are previewed.
Utilizing JSF Front Ends with MicroservicesJosh Juneau
The document discusses utilizing Jakarta Server Faces and Jakarta RESTful Web Services to build front ends for microservices. It provides an overview of the technologies and frameworks, including new features of JSF 2.3 and Jakarta RESTful Web Services. It then demonstrates how to create a simple RESTful service using JAX-RS and JPA, and build a JSF front end to communicate with the service and display database data. The presentation recommends approaches for writing and modifying data via REST, securing services, and using various Java EE and third-party libraries.
Introduction to the Spring Framework:
Generar description
IoC container
Dependency Injection
Beans scope and lifecycle
Autowiring
XML and annotation based configuration
Additional features
This document provides an introduction to JDBC (Java Database Connectivity) and how to connect to and query databases using JDBC. It discusses loading the appropriate JDBC driver, establishing a connection to the database using that driver, creating statements to execute queries, and processing the result sets returned by queries. It includes code examples to demonstrate connecting to a sample bikes database, executing a simple SELECT query, and iterating through the result set.
This document provides an overview of JDBC (Java Database Connectivity) including:
- JDBC allows Java applications to connect to databases using SQL and handles vendor differences through drivers.
- There are 4 types of JDBC drivers that handle database connections differently.
- Key JDBC interfaces like Connection, Statement, PreparedStatement, CallableStatement, ResultSet allow executing queries and accessing results.
- Stored procedures can be executed through CallableStatements. Transactions ensure atomic execution across databases. Connections must be closed in the proper sequence.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It adds optional static types, classes, and interfaces to JavaScript to help catch errors. TypeScript supports object-oriented programming concepts like classes, interfaces, inheritance, and modules. It is compatible with JavaScript and can reuse existing JavaScript code and libraries. The TypeScript compiler checks for errors and compiles TypeScript code into JavaScript that can run on any browser, device, or operating system that supports JavaScript.
Java EE (Java Platform, Enterprise Edition) is a set of specifications that provide functionality for developing multi-tiered, scalable, secure, and robust server-side applications. It extends the Java SE platform by providing APIs for common enterprise features like web services, transactions, security, and more. Java EE applications are hosted on Java EE servers, which provide runtime environments called containers that implement the Java EE specifications and provide services to applications. Common Java EE servers include GlassFish, JBoss, and WebLogic.
Contributors Guide to the Jakarta EE 10 GalaxyJakarta_EE
Jakarta EE 10 will focus on aligning specifications with CDI and Java SE, including adding CompletableFuture to concurrency and modernizing asynchronous annotations. It will also work on standalone APIs, modularization, closing standardization gaps, and a potential microservices profile. The document encourages contributing to Jakarta EE by advocating for changes, helping with implementations, and engaging ambassadors. Future versions may integrate with Java records, support JSON schemas, and add reactivity.
50 New Features of Java EE 7 in 50 minutesArun Gupta
The document discusses 50 new features in Java EE 7 presented over 50 minutes. It provides summaries of features including finer control over CDI scanning, interceptor bindings for constructors and methods, managed concurrency utilities like executors and thread factories, schema generation and indexes for JPA, and a simplified JMS API.
This document provides an overview of Spring MVC including:
- Spring MVC is a web framework built on the Servlet API that uses the MVC pattern. It features a DispatcherServlet that handles requests and delegates to controllers.
- The request processing workflow in Spring MVC involves the DispatcherServlet dispatching tasks to controllers, which interact with services and return a view name. The view is then rendered using a ViewResolver.
- Spring MVC applications use a WebApplicationContext containing web-related beans like controllers and mappings, which can override beans in the root context. Configuration can be done via XML or Java-based approaches. Important annotations map requests and bind parameters.
In this session, we take a look at a handful of the features that will be part of the upcoming Java EE 8 release, as well as a few of the existing features that can be utilized in Java EE 7 today. Each of the features are presented via a recipe in the "Problem", "Solution", and "How it Works" format.
JSF 2 Notes with coding examples topics include introduction , managed bean, jsf tags, navigation, jsf life cycle and phase listners,jsf validation and converters, i18n
The document provides an overview of new features in Java EE 7, including WebSocket support, JSON processing, batch applications, concurrency utilities, simplified JMS API, and enhancements to other Java EE technologies. It discusses 10 top features in more depth and includes code examples. The goal is to help developers get started with Java EE 7.
The document discusses 24 interview questions related to Java Collections Framework. It covers common questions about the key interfaces and classes in Collections like HashMap, ArrayList, Vector, Iterator, differences between HashMap and Hashtable, fail-fast property, and more. Example questions include what is difference between Iterator and ListIterator, when to use Hashtable vs HashMap, how to make a HashMap synchronized, and importance of hashCode() and equals() methods.
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlArjun Thakur
Hi, I just prepared a presentation on Java Spring Framework, the topics covered include architecture of Spring framework and it's modules. Spring Core is explained in detail including but not limited to Inversion of Control (IoC), Dependency Injection (DI) etc. Thank you and happy learning. :)
The Eclipse Transformer is an open source project that provides an engine for transforming Java artifacts like classes, manifests, and deployment descriptors. It replaces Java package references to transform artifacts from JavaEE to Jakarta specifications. The transformer is used by server projects like WildFly and TomEE to generate Jakarta versions of their distributions, and by Open Liberty for OSGi bundles and tests to update package references from JavaEE to Jakarta.
The document discusses servlet fundamentals and the three-tier model for web applications. It describes the three tiers as the client side (web browser), server side (web server/application server), and database (DBMS) tiers. It explains how servlets allow separating the business logic from the user interface, and how they provide dynamic web content through the Java programming language. Common Gateway Interface (CGI) and its drawbacks are also summarized.
This document discusses server-side programming and servlets. It defines a web application as an application accessible from the web, composed of web components like servlets that execute on the web server. It describes CGI technology and its disadvantages. It then discusses server-side scripting, why server-side programming is important for enterprise applications, and the advantages it provides over client-side programming. The document outlines different types of server-side programs and provides details on servlets, the servlet container, servlet API, and the servlet lifecycle.
Servlets as introduction (Advanced programming)Gera Paulos
Servlets allow servers to generate dynamic web page content. Servlets are Java programs that run on web servers to respond to client HTTP requests by generating documents like HTML pages. Servlets extend server functionality beyond static pages by enabling content generation, secure access, database interaction, and session tracking for each client. The servlet container receives requests and directs them to servlets, which process requests and return responses like HTML documents to clients. Servlets offer advantages over CGI like better performance since they run within the server address space rather than as separate processes.
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...WebStackAcademy
Servlet Technology is used to create web applications. Servlet technology uses Java language to create web applications.
As Servlet Technology uses Java, web applications made using Servlet are Secured, Scalable and Robust.
Web applications are helper applications that resides at web server and build dynamic web pages. A dynamic page could be anything like a page that randomly chooses picture to display or even a page that displays the current time.
Servlets are Java programs that extend the functionality of a web server. They allow for dynamic web page generation in response to client requests. Servlets offer advantages over CGI programs like improved performance since they do not create a new process for each request. The lifecycle of a servlet involves init(), service(), and destroy() methods. Servlets can be created and tested using the Tomcat servlet container. Security restrictions apply to untrusted servlets to prevent potentially dangerous operations, similarly to applets.
The document provides an overview of advanced Java topics for an industrial training course, including introductions to Java, J2EE, MVC architecture, Java Server Pages, JavaBeans, servlets, how servlets work, cookies and sessions, creating a simple servlet, and JDBC. It describes these technologies and how they are used to develop web applications and interact with databases.
Edge 2016 Session 1886 Building your own docker container cloud on ibm power...Yong Feng
The material for IBM Edge 2016 session for a client use case of Spectrum Conductor for Containers
https://www-01.ibm.com/events/global/edge/sessions/.
Please refer to http://ibm.biz/ConductorForContainers for more details about Spectrum Conductor for Containers.
Please refer to https://www.youtube.com/watch?v=7YMjP6EypqA and https://www.youtube.com/watch?v=d9oVPU3rwhE for the demo of Spectrum Conductor for Containers.
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...Edward Burns
Servlet is very easily the most important standard in server-side Java. The much awaited HTTP/2 standard is now complete, was fifteen years in the making and promises to radically speed up the entire web through a series of fundamental protocol optimizations.
In this session we will take a detailed look at the changes in HTTP/2 and discuss how it may change the Java ecosystem including the foundational Servlet 4 specification included in Java/Jakarta EE 8.
This document provides an overview of servlets. It discusses that servlets are used to create dynamic web applications and reside on the server-side to generate dynamic web pages. Servlets improve performance over CGI and execute within the web server's address space. The document outlines the servlet lifecycle and architecture, including the javax.servlet and javax.servlet.http packages that provide interfaces and classes for building servlets. It also provides examples of how to write simple servlets that can handle HTML form data submitted from a client.
This document provides an overview of server-side web programming and technologies like CGI, servlets, and JSP. It discusses how static and dynamic pages work, as well as the Common Gateway Interface (CGI) standard. CGI allows building dynamic websites by running programs on the server. The document then covers how servlets provide an improvement over CGI with benefits like improved performance, portability, and security. It provides examples of invoking servlets and describes the servlet API.
This document provides an overview of server-side web programming and different technologies used to create dynamic web pages, including Common Gateway Interface (CGI), servlets, and JavaServer Pages (JSP). CGI allows building dynamic web sites by running programs on the server that can generate HTML responses. Servlets provide a Java-based alternative to CGI with improved performance, portability, and security. Servlets use a request-response model and are executed by a servlet container. JSP is a technology that simplifies web page programming by mixing static elements like HTML with scripting code.
This document provides an overview of server-side web programming and technologies like CGI, servlets, and JSP. It discusses how static and dynamic pages work, as well as the Common Gateway Interface (CGI) standard. CGI allows building dynamic websites by running programs on the server. The document then covers how servlets provide an improvement over CGI with benefits like improved performance, portability, and security. It provides examples of invoking servlets and the servlet API.
The document discusses the evolution of using the web as a real application platform. It outlines key technologies like HTML5, JavaScript, and WebGL that have advanced the capabilities of web applications. The document also notes shortcomings in earlier versions of the web around user interaction, performance, and compatibility issues. However, new technologies and browser improvements have helped address many of these issues. The document concludes that the web is becoming a viable platform for developing full-featured applications that combine the benefits of installed software and web-based applications.
The NetBeans IDE provides helpful features for developing web applications:
1. It represents web applications with a project view for development and a file view for the built application, hiding complexities.
2. It generates and maintains Ant build scripts to automate compiling, cleaning, testing, WAR file creation, and deployment.
3. It offers syntax highlighting, code completion and other aids for developing JSP, HTML, servlets and more while detecting errors.
1. The document discusses various aspects of server-side programming including servlets and JSP. It defines what a server and servlet are, and explains the servlet lifecycle.
2. It then introduces JSP as an extension of servlets that simplifies dynamic web development. Key features of JSP like scriptlets, directives, and tags are described.
3. The document concludes by discussing how JSP pages are translated into servlets at runtime and processed to generate responses for client requests.
Cloud compiler - Minor Project by students of CBPGEC vipin kumar
The document describes a cloud compiler system that allows users to compile, run, test and debug code in various programming languages like Java, HTML, SQL, and C# without installing compilers locally. It discusses key aspects of the system like the objective, introduction, platforms and technologies used like Tomcat server, Java Server Pages, and Struts framework. Some benefits highlighted are that it is user friendly, supports multiple languages, and allows accessing programs from any device with an internet connection.
Web applications allow users to interact with dynamic content through a web browser rather than a local application. They utilize client-server architecture and communicate through HTTP requests and responses. Key components include web servers, which host the applications, and web containers that provide runtime services to web components like servlets and JSP pages. Web applications offer advantages like centralized data storage and 24/7 accessibility from anywhere but also present challenges in supporting different browsers and securing sensitive information.
The document provides an overview of React including its introduction, prerequisites, installation, fundamentals, components, life cycle, routing, hooks, Redux, projects, testing, comparison to Angular, and tips for React developers. It discusses key React concepts such as JSX, props, state, events, DOM, and virtual DOM.
The document discusses Spring framework concepts including inversion of control (IOC), dependency injection, Spring modules, the IOC container, and configuring beans through XML. It provides examples of injecting properties, constructor arguments, inner beans, and aliases in the Spring XML configuration file. The examples demonstrate how Spring's IOC container instantiates, configures and wires Java objects defined as beans in the configuration.
Data Science applications on logistics. This will give overall data science applicability on various feilds of logistc management. Research and Trends, framework, forward, backward, process, move my goods, my goods, requests, beautiful soap, selenium, tools, arohaka technologies,exploratory data science, feature engineering, model building
This document provides information about becoming an entrepreneur, including defining what an entrepreneur is, identifying common types of entrepreneurs, listing advantages of entrepreneurship, and outlining typical steps to become an entrepreneur. It discusses permits and registrations required, choosing a legal structure, developing an idea and value proposition, understanding the industry, and conducting market and financial feasibility analyses. A case study of the successful Indian startup RedBus is also included, which began as the founder struggled to book a bus ticket home.
This document provides an overview of the Java programming language. It discusses Java's history and why it was created. It also outlines some of Java's key fundamentals like variables, data types, operators, and control statements. Additionally, it covers object-oriented programming concepts in Java like classes, objects, inheritance and encapsulation. The document is intended to help readers get started with learning Java.
The document provides an overview of Git and GitHub. It discusses version control systems and the differences between centralized (CVCS) and distributed (DVCS) version control systems. Git is introduced as a DVCS that allows for complex merges and fast collaboration. The document then covers Git concepts, commands, workflows and how to use GitHub for hosting Git repositories and collaborating on projects.
Jenkins is an open source tool that automates the continuous integration process. It monitors source code repositories for changes, automatically builds the code, runs tests, and provides feedback to developers. Before CI tools like Jenkins, software delivery was slow and locating bugs after integration was difficult. With Jenkins, every code change triggers an automatic build and test, improving feedback and release frequency while reducing bug fixing time. Jenkins has over 1000 plugins and alternatives include Travis CI, Buildbot, Bamboo, and JetBrains TeamCity.
This document provides an overview of digital marketing, including definitions of key terms like digital marketing, search engine optimization, social media marketing, content marketing, and more. It discusses various digital marketing tactics like search engine marketing, social media, digital advertising, video marketing, email marketing, and mobile marketing. The document also covers affiliate marketing and how to start a business using different digital marketing strategies like content marketing, email marketing, and pay-per-click advertising.
The document discusses the importance of training for employees and organizations. It notes that training is important for development, helps increase productivity and reduce costs, and prevents skills from becoming obsolete. The document also outlines different methods of training, including on-the-job and off-the-job training. It provides details on identifying training needs, requirements, and approaches. Finally, the document discusses coaching and why people may seek coaching to help accomplish goals, resolve problems, and increase their leadership and professional capacities.
The document provides an overview of a project orientation covering topics like the definition of a project, project lifecycles like waterfall and agile models, career planning and trends, and the importance of training. It also introduces three local IT companies in Bengaluru and Mysuru that provide services like application development, training, and internships.
The document discusses different SQL database standards and implementations including MySQL, SQL Server, Oracle DB, and PostgreSQL. It provides an overview of each database including their key features and limitations. It also compares the databases across features such as licensing, server-side scripts, operating system support, and ACID properties. Finally, it presents statistics on the top deployed databases from surveys in 2004 and 2009.
The document provides an overview of DAO, ORM tools Hibernate, iBATIS, OJB and JPA. It discusses what each tool is, its features and advantages. A comparison table compares the tools on factors like simplicity, performance, dependence on SQL. Hibernate is recommended for object model driven environments that need automatic SQL generation. iBATIS is suitable when custom SQLs need to be created and maintained or for existing complex database schemas. JPA is intended for relational databases only.
How to Configure Time Off Types in Odoo 17Celine George
Now we can take look into how to configure time off types in odoo 17 through this slide. Time-off types are used to grant or request different types of leave. Only then the authorities will have a clear view or a clear understanding of what kind of leave the employee is taking.
No, it's not a robot: prompt writing for investigative journalismPaul Bradshaw
How to use generative AI tools like ChatGPT and Gemini to generate story ideas for investigations, identify potential sources, and help with coding and writing.
A talk from the Centre for Investigative Journalism Summer School, July 2024
Beyond the Advance Presentation for By the Book 9John Rodzvilla
In June 2020, L.L. McKinney, a Black author of young adult novels, began the #publishingpaidme hashtag to create a discussion on how the publishing industry treats Black authors: “what they’re paid. What the marketing is. How the books are treated. How one Black book not reaching its parameters casts a shadow on all Black books and all Black authors, and that’s not the same for our white counterparts.” (Grady 2020) McKinney’s call resulted in an online discussion across 65,000 tweets between authors of all races and the creation of a Google spreadsheet that collected information on over 2,000 titles.
While the conversation was originally meant to discuss the ethical value of book publishing, it became an economic assessment by authors of how publishers treated authors of color and women authors without a full analysis of the data collected. This paper would present the data collected from relevant tweets and the Google database to show not only the range of advances among participating authors split out by their race, gender, sexual orientation and the genre of their work, but also the publishers’ treatment of their titles in terms of deal announcements and pre-pub attention in industry publications. The paper is based on a multi-year project of cleaning and evaluating the collected data to assess what it reveals about the habits and strategies of American publishers in acquiring and promoting titles from a diverse group of authors across the literary, non-fiction, children’s, mystery, romance, and SFF genres.
Webinar Innovative assessments for SOcial Emotional SkillsEduSkills OECD
Presentations by Adriano Linzarini and Daniel Catarino da Silva of the OECD Rethinking Assessment of Social and Emotional Skills project from the OECD webinar "Innovations in measuring social and emotional skills and what AI will bring next" on 5 July 2024
Slide Presentation from a Doctoral Virtual Open House presented on June 30, 2024 by staff and faculty of Capitol Technology University
Covers degrees offered, program details, tuition, financial aid and the application process.
Principles of Roods Approach!!!!!!!.pptxibtesaam huma
Principles of Rood’s Approach
Treatment technique used in physiotherapy for neurological patients which aids them to recover and improve quality of life
Facilitatory techniques
Inhibitory techniques
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...Neny Isharyanti
Presented as a plenary session in iTELL 2024 in Salatiga on 4 July 2024.
The plenary focuses on understanding and intepreting relevant TPACK competence for teachers to be adept in teaching multimodality in the digital age. It juxtaposes the results of research on multimodality with its contextual implementation in the teaching of English subject in the Indonesian Emancipated Curriculum.
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894PECB
As artificial intelligence continues to evolve, understanding the complexities and regulations regarding AI risk management is more crucial than ever.
Amongst others, the webinar covers:
• ISO/IEC 42001 standard, which provides guidelines for establishing, implementing, maintaining, and continually improving AI management systems within organizations
• insights into the European Union's landmark legislative proposal aimed at regulating AI
• framework and methodologies prescribed by ISO/IEC 23894 for identifying, assessing, and mitigating risks associated with AI systems
Presenters:
Miriama Podskubova - Attorney at Law
Miriama is a seasoned lawyer with over a decade of experience. She specializes in commercial law, focusing on transactions, venture capital investments, IT, digital law, and cybersecurity, areas she was drawn to through her legal practice. Alongside preparing contract and project documentation, she ensures the correct interpretation and application of European legal regulations in these fields. Beyond client projects, she frequently speaks at conferences on cybersecurity, online privacy protection, and the increasingly pertinent topic of AI regulation. As a registered advocate of Slovak bar, certified data privacy professional in the European Union (CIPP/e) and a member of the international association ELA, she helps both tech-focused startups and entrepreneurs, as well as international chains, to properly set up their business operations.
Callum Wright - Founder and Lead Consultant Founder and Lead Consultant
Callum Wright is a seasoned cybersecurity, privacy and AI governance expert. With over a decade of experience, he has dedicated his career to protecting digital assets, ensuring data privacy, and establishing ethical AI governance frameworks. His diverse background includes significant roles in security architecture, AI governance, risk consulting, and privacy management across various industries, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: June 26, 2024
Tags: ISO/IEC 42001, Artificial Intelligence, EU AI Act, ISO/IEC 23894
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
Views in Odoo - Advanced Views - Pivot View in Odoo 17Celine George
In Odoo, the pivot view is a graphical representation of data that allows users to analyze and summarize large datasets quickly. It's a powerful tool for generating insights from your business data.
The pivot view in Odoo is a valuable tool for analyzing and summarizing large datasets, helping you gain insights into your business operations.
Credit limit improvement system in odoo 17Celine George
In Odoo 17, confirmed and uninvoiced sales orders are now factored into a partner's total receivables. As a result, the credit limit warning system now considers this updated calculation, leading to more accurate and effective credit management.
Front Desk Management in the Odoo 17 ERPCeline George
Front desk officers are responsible for taking care of guests and customers. Their work mainly involves interacting with customers and business partners, either in person or through phone calls.
Join educators from the US and worldwide at this year’s conference, themed “Strategies for Proficiency & Acquisition,” to learn from top experts in world language teaching.
The Value of Time ~ A Story to Ponder On (Eng. & Chi.).pptxOH TEIK BIN
A PowerPoint presentation on the importance of time management based on a meaningful story to ponder on. The texts are in English and Chinese.
For the Video (texts in English and Chinese) with audio narration and explanation in English, please check out the Link:
https://www.youtube.com/watch?v=lUtjLnxEBKo
1. 2 December 2021 1
Servlet
Name :: Mallikarjuna G D
Reach me @ Training ::
Email :: gdmallikarjuna@gmail.com
2. 2 December 2021 2
Agenda
• Introduction to Web Application Technologies
• CGI Programs on the Web Server
• What is servlet?
• Jobs of servlet
• Advantages over CGI
• Why pages are build dynamically?
• Servlet container
• Installation & configuration
- Type 1: Integration of Tomcat server and eclipse
- Type 2: Java Servlet
• Servlet Sample Example
• Servlet Overview And Architecture
- Servlet Life cycle/Single Thread Model
- Interface Servlet
- HttpServlet Class
- HttpServletRequest, HttpServletResponse
3. 2 December 2021 3
Agenda
• Handling client request :Http request
• Generating Server Response : Http status code
• Handling Session
- Cookies
- Session Tracking
- URL-re writing
- Hidden Form fields
4. 2 December 2021 4
Introduction to Web Application Technologies
• World Wide Web:
HTTP (Hypertext Transfer Protocol) is similar to FTP because it is a protocol to
transfer files from the server to client. HTTP was created in conjunction with
related HTML standard.
HTML (Hypertext Markup Language) is a document display language that lets
users link from one document to another.
HTML permits images and other media objects to be embedded in an HTML
document. The media objects are stored in files on a server.
HTTP also retrieves these files. Therefore HTTP can be used to transmit any
file that confirms to multipurpose Internet Mail Extensions (MIME) specification.
5. 2 December 2021 5
• Web Browsers and and Web Servers:
To view an HTML document with rich media content, a graphical user interface
was built on the top of the client-side HTTP.
This GUI is called as web browser. The server-side HTTP component is called
a web server.
• Web Applications:
Early in the development of HTML, the designers created a mechanism to
permit a user to invoke a program on the web server. This mechanism was
called as Common Gateway Interface (CGI). When a website includes CGI
processing, this is called a web application.
(Contd..)
6. 2 December 2021 6
CGI Programs on the Web Server
• The browser needs to send data to the CGI program on the server. The CGI
specification defines how the data is packaged and sent in the HTTP request to
the server. This data is usually typed into the web browser in an HTML form.
• The URL determines which CGI program to execute.
This might be a script or an executable file.
• The CGI program parses the CGI data in the request, processes the data, and
generates a response.
• The CGI response is sent back to the web server, which wraps the response
in an HTTP response.
• The HTTP response is sent back to the web browser.
7. 2 December 2021 7
Web Server Architecture with CGI Programs
(Contd..)
8. 2 December 2021 8
Advantages and Disadvantages of CGI Programs
• Programs can be written in a variety of languages, although they are primarily
written in Perl.
• A CGI program with bugs does not crash the web server.
• Programs are easy for a web designer to reference. When the script is written, the
designer can reference it in one line in a web page.
• Because CGI programs execute in their own OS Shell, these programs do not have
concurrency conflicts with other HTTP requests executing the same CGI program.
• All service provides support CGI programs.
9. 2 December 2021 9
• The response time of CGI programs is high because CGI programs execute in their
own OS shell. The creation of an OS shell is a heavyweight activity for the OS.
• CGI is not scalable.
• The languages for CGI are not always secure or object-oriented.
• The CGI script has to generate an HTML response, so the CGI code is mingled with
HTML. This is not good separation of presentation and business logic.
• Scripting languages are often platform-dependent.
Disadvantages
10. • Servlet is a program that runs on server acts as a middle layer between a request
coming from web-browser or other HTTP Clients and database or applications on
the Server.
• Improved substitute for CGI Scripts.
• Are executed in context of web server.
• Part of JEE (Servlet API 2.4)
• Helps client server communication.
2 December 2021 10
What is Servlet?
11. 2 December 2021 11
Jobs of servlet?
• Read explicit data sent by client (form data)
• Read implicit data sent by client (request header)
• Generate the result
• Send the explicit data back to client (e.g. HTML format)
• Send the implicit data to client (status code and response
header)
Servlet:
HTTP
Web
Server
File system
Servlet
Server
Static
Tomcat = Web Server + Servlet Server
Other..
Dynamic
12. 2 December 2021 12
Advantages of Servlet over CGI
• Efficient/Scalable-handled by separate thread within web-server
process.
• Convenient - lot of high level utilities.
• Powerful – Sharing data, pooling, persistence.
• Portable – Run virtually on all operating systems and servers.
• Security – No shell escapes, no bufferflow.
• Inexpensive.
13. 2 December 2021 13
Disadvantages:
• Servlets often contain both business logic and presentation logic. Presentation
logic is anything that controls how the application presents information to the
user. Generating the HTML response within the servlet code is presentation
logic.
Business logic is anything that manipulates data to accomplish something such
as storing data.
• Servlets must handle concurrency issues.
• Mixing presentation and business logic means that whenever a web page
changes the servlets must be rewritten, recompiled and redeployed.
• This disadvantage led to the development of template pages, including Java
Server Pages technology.
14. 2 December 2021 14
Why build pages dynamically?
• The web page is based on data submitted by the user.
e.g.:- result in search engines , online shopping so on.
• The web pages are derived from the data changes frequently.
e.g.:-weather report, stock exchange, news headline.
• The web pages are derived from data from databases or other server side
resources.
e.g.:- e-commerce page shows availability of product with price
information.
15. 2 December 2021 15
Servlet Container/Servlet Engine
• The servlet container is compiled, executable program. The container acts as
intermediator between webserver and servlet in the container.
• The container loads, initializes and executes servlet. When request arrives
container maps to servlet.
• The container is designed to perform well by serving large number of requests.
A container can hold any number of servlets, filters and listener.
• Both the container and object contained in it are multithreaded. The container
handles multiple requests concurrently, and more than one thread may enter an
object at a time. Therefore, each object within a container must be thread safe.
16. 2 December 2021 16
(Contd..)
There are three kinds of servlet engine
- standalone
- add on
- embedded
• Standalone Servlet Engines
- Built in support for servlets.
- Hard to keep latest version of servlet.
• Add on servlet Servlet-engines
- Plug-in to an existing servlets.
• Embeddable servlet engines
- lightweight servlet-deployment platform that can be
embedded in another application.
17. 2 December 2021 17
List of servlet containers
Non commercial:
• Apache Tomcat (formerly Jakarta Tomcat) is an open source web
container available under the Apache Software License.
• Apache Geronimo -is a full Java EE implementation by Apache.
• Jetty
• Jaminid - contains a higher abstraction than servlets.
• Enhydra
• Winstone - supports specification v2.4, has a focus on minimal configuration
and the ability to strip the container down to only what you need.
• tjws - spec 2.4, small footprint, modular design
18. 2 December 2021 18
Commercial:
• BEA WebLogic Server or Weblogic Express, from BEA Systems
• Borland Enterprise Server
• GlassFish (open source)
• Java System Application Server, from Sun Microsystems
• Java System Web Server, from Sun Microsystems
• JBoss (open source)
• JRun, from Adobe Systems (formerly developed by Allaire Corporation)
(Contd..)
19. 2 December 2021 19
• LiteWebServer (open source)
• Oracle Application Server, from Oracle Corporation
• Orion Application Server, from IronFlare
• Caucho's Resin Server
• ServletExec, from New Atlanta Communications
• WebObjects, from Apple Inc.
• WebSphere, from IBM
(Contd..)
20. 2 December 2021 20
• The Servlet API, contained in the Java package hierarchy javax.servlet,
defines the expected interactions of a Web container and a servlet.
• A Web container is essentially the component of a Web server that interacts
with the servlets. The Web container is responsible for managing the lifecycle of
servlets, mapping a URL to a particular servlet and ensuring that the URL
requester has the correct access rights.
• A Servlet is an object that receives a request and generates a response based
on that request.
The basic servlet package defines Java objects to represent servlet requests
and responses, as well as objects to reflect the servlet's configuration
parameters and execution environment
Java Servlet API
21. 2 December 2021 21
Servlet API History
The complete servlet specification was created by Sun Microsystems, with
version 1.0 finalized in June 1997.
Starting with version 2.3, the servlet specification was developed under the
Java Community Process.
22. 2 December 2021 22
Installation and Configuration
• Step 1: jdk 11.0
• Download the JDK 11.0 offline installation file (Windows Offline Installation,
Multi-language) from Oracle'
https://www.oracle.com/java/technologies/downloads/#java11-windows. The
online installation will download the installation files through the internet and
you will have to re-download them each time you format your HD.
• Double click on the .exe file (throughout I assume XP or VISTA or Windows
10, or some other crappy Micro$oft OS).
The following screen should pop up:
24. 2 December 2021 24
(Contd..)
We still have to go that extra bit and set up some environment variables -
primarily create JAVA_HOME and edit the PATH system variable. In the
computers Control Panel double click on the System icon and select the
Advanced tab. The result should be something not foreign to the screenshot
below:
25. 2 December 2021 25
(Contd..)
Set path to the java_home/bin:, finally restart.. And open command prompt to
check java installed by giving java –version in prompt.
26. 2 December 2021 26
• Step 2: Install Eclipse
download eclipse IDE from http://www.eclipse.org/downloads/
and extract to the required folder.
• Step 3: Install Jakarta Tomcat
download tomcat 9.x from this site in zip format
http://tomcat.apache.org/, then extract to required folder.
(Contd..)
27. 2 December 2021 27
(Contd..)
• Step 5: Configure Eclipse
- start eclipse, and do configuration as per below screen shots.
29. 2 December 2021 29
Simple Servlet configuration & development
1. Select File > New > Dynamic Web Project..
30. 2 December 2021 30
(Contd..)
Input the following code in to the file SimpleServlet.java and click Save button in
toolbar.
import java.io.PrintWriter;
public class SimpleServlet extends javax.servlet.http.HttpServlet {
public void doGet(javax.servlet.http.HttpServletRequest
request, javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException, java.io.IOException {
performTask(request, response);
}
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException, java.io.IOException {
performTask(request, response);
}
31. 2 December 2021 31
(Contd..)
public void performTask(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
{
try {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println( "This is a Simple Servlet Demo");
} catch(Throwable theException) {
//theException.printStackTrace();
}
}
}
33. 2 December 2021 33
(Contd..)
Press the Start Tomcat button in tool bar, after tomcat starts, open
a browser and input the URL:
http://localhost:8080/ServletDemo/SimpleServlet
The result will show as below:
34. 2 December 2021 34
(Contd..)
Finally, run the server to see output.
36. 2 December 2021 36
Servlet Life cycle and Architecture
Servlets are first standard to extension to java including two packages:
-javax.servlet
-javax.servlet.http
In general, servlet
1. Generic Servlet
- must extend javax.servlet.Servlet
- protocol independent
2. Http Servlet
- must extend javax.servlet.http.HttpServlet
- Handling Http request/reply
38. 2 December 2021 38
Servlet Life Cycle
• The life cycle of a servlet is controlled by the container in which the servlet
has been deployed.
When a request is mapped to a servlet, the container performs the following
steps:
- If an instance of the servlet does not exist, the Web container
loads the servlet class. Creates an instance of the servlet class.
Initializes the servlet instance by calling the init method.
- Invokes the service method, passing a request and response
object.
• If the container needs to remove the servlet, it finalizes the servlet by calling
the servlet's destroy method.
40. 2 December 2021 40
(Contd..)
Java class that implements the Servlet interface
• Servlet Interface
– Defines the Servlet’s life cycle methods.
– init(ServletConfig config)
– service(ServletRequest req, ServletResponse res)
- doGet handles GET request.
- doPost handles POST request.
– destroy()
Called by the servlet container before servlet is taken out of service.
41. 2 December 2021 41
Allowing concurrency: Single thread Model
• Container may send multiple request to single instance , using java threads. So
service methods (doGet, doPost..) are all thread safe. It means two or more threads
operating without interfere each other.
• If service methods not thread safe. We have to use single thread model.
• The single thread model ensures that only one service method runs at time
43. 2 December 2021 43
Methods of Servlet
Method Description
void init(
ServletConfig
config )
The servlet container calls this method once during a servlet’s execution cycle to
initialize the servlet. The ServletConfig argument is supplied by the servlet
container that executes the servlet.
ServletConfig
getServletConfig(
)
This method returns a reference to an object that implements interface
ServletConfig. This object provides access to the servlet’s configuration
information such as servlet initialization parameters and the servlet’s
ServletContext, which provides the servlet with access to its environment
(i.e., the servlet container in which the servlet executes).
String
getServletInfo()
This method is defined by a servlet programmer to return a string containing servlet
information such as the servlet’s author and version.
void service(
ServletRequest
request,
ServletResponse
response )
The servlet container calls this method to respond to a client request to the servlet.
void destroy() This “cleanup” method is called when a servlet is terminated by its servlet
container. Resources used by the servlet, such as an open file or an open database
connection, should be deallocated here.
44. 2 December 2021 44
Http Servlet
• Override the servlet class
• There are two types of request- Get and Post
- doGet responds to Get request
-doPost responds to Post request
• It has HttpServletRequest and HttpServletResponse Objects
45. 2 December 2021 45
(Contd..)
Method Description
doDelete Called in response to an HTTP delete request. Such a request is normally used to
delete a file from a server. This may not be available on some servers, because of
its inherent security risks (e.g., the client could delete a file that is critical to the
execution of the server or an application).
doHead Called in response to an HTTP head request. Such a request is normally used
when the client only wants the headers of a response, such as the content type and
content length of the response.
doOptions Called in response to an HTTP options request. This returns information to the
client indicating the HTTP options supported by the server, such as the version of
HTTP (1.0 or 1.1) and the request methods the server supports.
doPut Called in response to an HTTP put request. Such a request is normally used to
store a file on the server. This may not be available on some servers, because of
its inherent security risks (e.g., the client could place an executable application on
the server, which, if executed, could damage the server—perhaps by deleting
critical files or occupying resources).
doTrace Called in response to an HTTP trace request. Such a request is normally used for
debugging. The implementation of this method automatically returns an HTML
document to the client containing the request header information (data sent by the
browser as part of the request).
46. 2 December 2021 46
HttpServletRequest Interface
• Web server
- creates an HttpServletRequest object.
- passes it to the servlet’s service method.
• HttpServletRequest object contains the request from the client.
47. 2 December 2021 47
(Contd..)
Method Description
String getParameter(
String name )
Obtains the value ofa parameter sent to the servlet as part ofa get or post
request. The name argument represents the parameter name.
Enumeration
getParameterNames()
Returns the names ofallthe parameters sent to the servlet as part ofa post
request.
String[]
getParameterValues(
String name )
For a parameter with multiple values, this method returns anarrayofstrings
containing the values for a specified servlet parameter.
Cookie[] getCookies() Returns anarrayof Cookie objects stored onthe client bythe server. Cookie
objects canbe used to uniquely identifyclients to the servlet.
HttpSession getSession(
booleancreate )
Returns an HttpSession object associated withthe client’s current browsing
session. This method cancreate an HttpSession object (true argument) ifone
does not alreadyexist for the client. HttpSession objects are used insimilar
ways to Cookies for uniquely identifying clients.
48. 2 December 2021 48
HttpServletResponse Interface
Method Description
void addCookie(
Cookie cookie )
Used to add a Cookie to the header of the response to the client. The
Cookie’s maximum age and whether Cookies are enabled on the client
determine if Cookies are stored on the client.
ServletOutputStream
getOutputStream()
Obtains a byte-based output stream for sending binary data to the client.
PrintWriter
getWriter()
Obtains a character-based output stream for sending text data to the client.
void
setContentType(
String type )
Specifies the MIME type of the response to the browser. The MIME type
helps the browser determine how to display the data (or possibly what
other application to execute to process the data). For example, MIME type
"text/html" indicates that the response is an HTML document, so the
browser displays the HTML page.
• Web server
- creates an HttpServletResponse object.
- passes it to the servlet’s service method.
51. 2 December 2021 51
Common HTTP Request Header 1.1
• Accept
- MIME Types of browser can handle.
- Can send different content to different clients.
• Accept-Encoding
- Indicate encoding (e.g gzip) browser can handle.
• Authorization
- User identification for password protected pages.
• Connection
- In Http 1.1, keep alive means browser can handle persistent
connection. Persistent connection is default. Persistent means same
socket is reused for same type of client request.
52. 2 December 2021 52
(Contd..)
• Cookie
- Give cookies previously sent to client.
• Host
- It gives host given in original URL.
• If-Modified-Since
- Client wants pages, only after changed on some specified
dates.
• Referrer
- URL of referring web page.
- Useful for tracking traffic; logged by many servers.
• User Agent
- String identifying the browser making request.
53. 2 December 2021 53
Generating server response: http status code
Purpose: The variety of status code that are essentially indicate failure.
e.g.:- HTTP/1.1 200 OK
• Changing a status code perform a lot of tasks.
- Forward client to another page.
- Indicate a missing resource.
- Instruct a browser to use cached copy.
• Set status before sending document.
public void setStatus (int statusCode)
- use constant for the code. Not an explicit int.
constants are HttpServletResponse.
- Names derived from standard message.
e.g SC_OK, SC_NOT_FOUND so on.
• public sendError(int code, String msg)
- Wraps the message inside HTML document.
54. 2 December 2021 54
(Contd..)
• Public void sendRedirect(String url)
- Relative url is permitted in 2.2/2.3
- Also sets location header.
Common HTTP 1.1 Status codes:
• 200(OK)
- Everything is fine, document follows, default for servlets.
• 204(No content)
- Browser should keep displaying previous document.
• 301(Moved document)
- Requested document moved elsewhere.
- Browsers go to new location automatically.
55. 2 December 2021 55
(Contd..)
• 401(unauthorized)
Browser tried to access protected page without proper authorization
header.
• 404(Not found)
No such page.
In general
100-199 -> codes in the 100s are informational, indicating that the
client should respond with some other action.
200-299 -> values in the 200’s signify that the request was
successful.
300-399 -> values in the 300’s are used for files that have moved
and usually include location header indicating the new address.
56. 2 December 2021 56
(Contd..)
400-499 -> values in the 400’s indicate an error by the client.
500-599 ->codes in the 500’s signify an error by the server.
Common MIME Type:
57. 2 December 2021 57
Session Handling
• A server site typically needs to maintain two types of persistent(remembered)
information:
- Information about the Session.
- Information about the User.
• Servlet capabilities:
Servlets, like Applets, can be trusted or untrusted.
- A servlet can use a unique ID to store and retrieve information
about a given session.
- User information usually requires a login ID and a password.
- Since servlets don’t quit between requests, any servlet can maintain
information in its internal data structures, as long as the server keeps
running.
58. 2 December 2021 58
(Contd..)
- A trusted servlet can read and write files on the server,
hence can maintain information about sessions and users
even when the server is stopped and restarted.
- An untrusted servlet will lose all information when the
servlet or server stops for any reason.
This is sometimes good enough for session
information.
This is almost never good enough for user
information.
- HTTP is stateless: When it gets a page request, it has no
memory of any previous requests from the same client.
59. 2 December 2021 59
(Contd..)
• Session tracking is keeping track of what has gone before in this particular
conversation.
- Since HTTP is stateless, it does not do this for you.
- You have to do it yourself, in your servlets.
- This makes it difficult to hold a “conversation”.
Typical example: Putting things one at a time into a shopping cart, then
checking out--each page request must somehow be associated with
previous requests.
- The server must be able to keep track of multiple conversations with
multiple users.
60. 2 December 2021 60
• Cookies are small files that the servlet can store on the client computer, and
retrieve later.
• URL rewriting: You can append a unique ID after the URL to identify the user.
• Hidden <form> fields can be used to store a unique ID.
• Java’s Session Tracking API can be used to do most of the work for you.
Session tracking solution
61. 2 December 2021 61
Cookies
• Cookies are small bits of textual information that a web server sends to the
browser and that the browser returns unchanged when later visiting the same
website or domain.
• Cookies are not a security threat.
• Cookies can be a privacy threat.
- Cookies can be used to customize advertisements.
- Outlook Express allows cookies to be embedded in email.
- A servlet can read your cookies.
Incompetent companies might keep your credit card info in
a cookie.
Netscape lets you refuse cookies to sites other than that to
which you connected.
62. 2 December 2021 62
Why do we need cookies?
• Cookies are a very useful tool in maintaining state (persistence) on the Web.
Unless something special is done, web servers are only aware of users when a
transaction -- sending or receiving information -- is in process. The moment the
transaction is complete the server forgets about the user and makes no attempt
to correlate subsequent transactions with previous exchanges.
• Since the web protocol, HTTP, is a "stateless" (non-persistent) protocol, it is
impossible to differentiate between visits to a given web site, unless the server
can somehow "mark" a visitor.
• This is done by storing a piece of information in the visitor's browser, called a
"cookie". Cookies can contain database information, custom page settings, or
just about anything that would make a site customizable.
63. 2 December 2021 63
Using cookies
• import javax.servlet.http.*;
• Constructor: Cookie(String name, String value)
• Assuming request is an HttpServletRequest and response is an
HttpServletResponse,
response.addCookie(cookie);
Cookie[ ] cookies = request.getCookies();
String name = cookies[i].getName();
String value = cookies[i].getValue();
• There are, of course, many more methods in the HttpServletRequest,
HttpServletResponse, and Cookie classes in the javax.servlet.http package.
64. 2 December 2021 64
(Contd..)
• public void setComment(String purpose)
- public String getComment()
• public void setMaxAge(int expiry)
- public int getMaxAge()
- Max age in seconds after which cookie will expire.
- If expiry is negative, delete when browser exits.
- If expiry is zero, delete cookie immediately.
• setSecure(boolean flag)
- public boolean get Secure()
- Indicates to the browser whether the cookie should only be
sent using a secure protocol, such as HTTPS or SSL.
65. 2 December 2021 65
(Contd..)
Here is the code snippet for initializing a cookie and adding the same to the
response object.
.....
Cookie cookie = new Cookie ("otncookiename",userName);
cookie.setMaxAge(86400);
response.addCookie(cookie);
Cookie onemorecookie = new Cookie("otncookiepassword",password);
onemorecookie.setMaxAge(86400);
response.addCookie (onemorecookie);
.....
Setting cookies:
66. 2 December 2021 66
(Contd..)
Retrieving a cookie value:
Here is the code snippet for selecting cookie values from the request object.
......
Cookie[] cookieArray = request.getCookies();
if( cookieArray != null) {
for( int i = cookieArray.length-1; i >= 0; i-- ) {
Cookie cookie = cookieArray[i];
System.out.println ("Cookie name is " + cookie.getName());
System.out.println ("Cookie value is " + cookie.getValue());
}
}
......
67. 2 December 2021 67
(Contd..)
Code snippet:
Login.html
<form name="login" method="post" action="./LoginCookieServlet">
<p>please enter login credentials</p>
User Name : <input type="text" name="txtUserName"> <br>
password : <input type="password" name="txtPassword"> <input
type="submit" value='submit'>
</form>
LoginCookieServlet
String name= request.getParameter("txtUserName");
String pwd = request.getParameter("txtPassword");
Cookie userNameCookie = new Cookie("USERNAME", name);
response.addCookie(userNameCookie);
Cookie passwordCookie = new Cookie("PASSWORD",pwd);
response.addCookie(passwordCookie);
request.getRequestDispatcher("/LoginNextCookie").forward(request, response);
69. 2 December 2021 69
Limitation
• The browser should be enabled to accept cookies.
• Cookie values must never have spaces, commas or semicolons.
• Cookies can store upto 4KB of value.
70. 2 December 2021 70
URL-Rewritting
• URL rewriting is another way to support anonymous session tracking.
• With URL rewriting, every local URL the user might click on is dynamically
modified, or rewritten, to include extra information.
• The extra information can be in the form of extra path information, added
parameters, or some custom, server-specific URL change.
• Due to the limited space available in rewriting a URL, the extra information is
usually limited to a unique session ID.
71. 2 December 2021 71
URL-Rewritting
• For example, the following URLs have been rewritten to pass the session ID
123:
http://server: port/servlet/Rewritten original
http://server:port/servlet/Rewritten/123 extra path information
http://server:port/servlet/Rewritten?sessionid=123 added
parameter
http://server:port/servlet/Rewritten;$sessionid$123
custom change
74. 2 December 2021 74
Hidden form fields
• One way to support anonymous session tracking is to use hidden form fields.
As the name implies, these are fields added to an HTML form that are not
displayed in the client's browser. They are sent back to the server when the
form that contains them is submitted. You include hidden form fields with HTML
like this:
• <FORM ACTION="/servlet/MovieFinder" METHOD="POST">
...
<INPUT TYPE=hidden NAME="zip" VALUE="94040">
<INPUT TYPE=hidden NAME="level" VALUE="expert">
..
</FORM>
In a sense, hidden form fields define constant variables for a form. To a servlet
receiving a submitted form, there is no difference between a hidden field and a
visible field.
75. 2 December 2021 75
Hidden form fields
• code snippet
Loginhidform.html
<form name="login" method="post" action="./HiddenServlet">
<p>please enter login credentials</p>
User Name : <input type="text" name="txtUserName"> <br>
password : <input type="password" name="txtPassword"> <input
type="submit" value='submit'>
</form>
HiddenServlet.java
String name = request.getParameter("txtUserName");
String pwd = request.getParameter("txtPassword");
out.print("<form action='./LoginUrlReceive'>");
out.print("<input type='hidden' name='uname' value='" + name + "'>");
out.print("<input type='hidden' name='pwd' value='" + pwd + "'>");
out.print("<input type='submit' value='go'>");
out.print("</form>");
77. 2 December 2021 77
Session tracking API
• The session tracking API is in javax.servlet.http.HttpSession and is built on
top of cookies.
• To use the session tracking API:
- Create a session:
HttpSession session = request.getSession();
Returns the session associated with this request
If there was no associated session, one is created.
- Store information in the session and retrieve it as needed:
session.setAttribute (name, value);
Object obj = getAttribute(name);
• Session information is automatically maintained across requests.
78. 2 December 2021 78
Looking up information associated with session
• getId - This method returns the unique identifier generated for each session.
It is sometimes used as the key name when there is only a single value
associated with a session, or when logging information about previous
sessions.
• isNew - This returns true if the client (browser) has never seen the session,
usually because it was just created rather than being referenced by an
incoming client request. It returns false for preexisting sessions.
79. 2 December 2021 79
• getCreationTime - This returns the time, in milliseconds since the epoch, at
which the session was made. To get a value useful for printing out, pass the
value to the Date constructor or the setTimeInMillis method of
GregorianCalendar.
• getLastAccessedTime - This returns the time, in milliseconds since the
epoch, at which the session was last sent from the client.
• getMaxInactiveInterval - This returns the amount of time, in seconds, that a
session should go without access before being automatically invalidated. A
negative value indicates that the session should never timeout.
(Contd..)
80. 2 December 2021 80
• Public Object getValue(String name)
• Public Object getAttribute (String name)
• Public Object setValue(String name, Object value)
• Public Object setAttribute (String name, Object value)
• Public Object removeValue(String name)
• Public Object removeAttribute(String name)
(Contd..)