Topics. Advanced Java Programming. Quick HTTP refresher. Quick HTTP refresher. Web server can return:

Size: px
Start display at page:

Download "Topics. Advanced Java Programming. Quick HTTP refresher. Quick HTTP refresher. Web server can return:"

Transcription

1 Advanced Java Programming Servlets Chris Wong Orginal notes by Dr Wayne Brookes and Threading Copyright UTS 2008 Servlets Servlets-1 Copyright UTS 2008 Servlets Servlets-2 Quick HTTP refresher HTTP is a TCPIP protocol used by the web Defaults to TCP port 80 Client (Web browser) requests web page from a server Identifies source via a URL Uses GET or POST requests Also can send Headers eg: user-agent (browser) Quick HTTP refresher Web server can return: STATIC web pages e.g. simple flat files eg: index.html, readme.txt images (GIF, JPG, PNG) eg: hello.gif media (MPEG, MP3 etc) DYNAMIC web pages generated by server eg: CGI, PHP, Perl, ASP, Java Server (Web server) responds file requested Typically HTML or GIF/JPG we mostly generate dynamic pages in J2EE Copyright UTS 2008 Servlets Servlets-3 Copyright UTS 2008 Servlets Servlets-4 Web application models and Threading Copyright UTS 2008 Servlets Servlets-5 Web application models Server can generate DYNAMIC web pages via: CGI web server runs external program for processing Server APIs (ISAPI / NSAPI) Web server loads library/modules eg: C, C++ DLL, LIB files Templates server interprets file, executes operations. Active Server Pages (.asp) eg: VBScript, Jscript PHP, ColdFusion Java Server Pages (.jsp) web server contains JVM this JVM runs Java code inside web server Copyright UTS 2008 Servlets Servlets-6

2 Web app models CGI request HTTP response Web Server CGI program CGI Interface Database access protocol Copyright UTS 2008 Servlets Servlets-7 Web app models CGI Advantages: simple model reuse of existing command-line programs robust (crash in program does not affect web server) Disadvantages: very resource-intensive new process created for each request memory/processor expensive OK for simple things definitely not scalable! program-centric coding i.e. code that generates HTML not page-centric Copyright UTS 2008 Servlets Servlets-8 Web app models server APIs = ISAPI/NSAPI i.e. function calls request HTTP response Web Server Server API program Database access protocol Web app models server APIs Advantages: highly efficient native code running as part of web server access to internal processing of web server can build filters, etc. Disadvantages: complex coding not robust (crash in your code crashes web server) difficult to debug (concurrent threads) Copyright UTS 2008 Servlets Servlets-9 Copyright UTS 2008 Servlets Servlets-10 Web app models templates request HTTP response Web Server Interpreter *.jsp Database access protocol Web app models templates Advantages: Page-centric Usually have HTML code, with embedded code Can be portable JSP, PHP are de-facto standards ASP, CFM are not Disadvantages: Performance Interpreted (but can be cached?) difficult to debug Run-time errors in HTML? We cover Java Server Pages next lecture Copyright UTS 2008 Servlets Servlets-11 Copyright UTS 2008 Servlets Servlets-12

3 Web app models servlets = Servlet API i.e. method calls request HTTP response Web Server JVM web container Servlet JDBC Web app models servlets Advantages: more efficient than CGI (threaded) robust (crash in servlet causes no damage) secure (servlet container can place security restrictions) access to rich Java libraries (eg: JDBC) portable between platforms/vendors Disadvantages: program-centric Java coding Your code generates HTML but see Java Server Pages (JSP) next week Copyright UTS 2008 Servlets Servlets-13 Copyright UTS 2008 Servlets Servlets-14 Servlets and Threading J2EE & Servlets Copyright UTS 2008 Servlets Servlets-15 Copyright UTS 2008 Servlets Servlets-16 Servlet loaded either: - web server starts; or - first request for servlet arrives Servlet ready to take requests Web server decides to remove this instance of servlet Servlet may be garbage collected Servlet lifecycle init() service() destroy() HTTP request arrives Methods defined in javax.servlet.servlet Servlet API and Threading Copyright UTS 2008 Servlets Servlets-17 Copyright UTS 2008 Servlets Servlets-18

4 Interfaces Abstract classes Exceptions Package javax.servlet Servlet API Generic servlet handling Package javax.servlet.http Specific for web servlets Defining servlet classes Recall: Java application: public class MyApp Java applet: public class MyApplet extends javax.swing.japplet Not specific to HTTP Servlet architecture designed to cope with any kind of request/response protocol For: format of HTTP request/responses Support for HTTP sessions Support for HTTP cookies Now: Java servlet: public class MyServlet extends javax.servlet.http.httpservlet Copyright UTS 2008 Servlets Servlets-19 Copyright UTS 2008 Servlets Servlets-20 Servlet API inheritance <<abstract>> javax.servlet.genericservlet <<abstract>> javax.servlet.http.httpservlet MyServlet implements implements <<interface>> javax.servlet.servlet <<interface>> java.io.serializable Java class libraries User code Copyright UTS 2008 Servlets Servlets-21 The Servlet API The Servlet Interface specifes the contract between the web container and a servlet containers use this interface to reference servlets implement this indirectly by extending javax.servlet.genericservlet or javax.servlet.http.httpservlet Methods void init(servletconfig config) called with ServletConfig parameter by the container container calls this before any request - guaranteed allows a servlet to load any initialization of parameters done once only / not per request Copyright UTS 2008 Servlets Servlets-22 The Servlet API Methods (contd) void service(servletrequest req, ServletResponse res) entry point for executing logic void destroy() container calls this before removing a servlet deallocate resources (specially non Java resources) ServletConfig getservletconfig() return the ServletConfig that was passed to init() Servlet programming theory To create a basic HTTP Java servlet, you must: extend javax.servlet.http.httpservlet implement the service() method to handle each incoming request should avoid this - why? see next slide first! optionally implement init() and destroy() methods String getservletinfo() return a String containing servlet information Copyright UTS 2008 Servlets Servlets-23 Copyright UTS 2008 Servlets Servlets-24

5 Servlet programming practice javax.servlet.http.httpservlet provides a default implementation of the service() method casts request / response to HTTP request / response calls its protected service() method service() uses getmethod() to call doxxx() method It makes calls to other methods, which YOU implement. The main two are: doget() HTTP GET requests dopost() HTTP POST requests Servlet example so far import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class MyServlet extends HttpServlet { public void doget( HttpServletRequest req, HttpServletResponse res) //... other code goes here... Copyright UTS 2008 Servlets Servlets-25 Copyright UTS 2008 Servlets Servlets-26 Requests and responses HTTP is a request/response protocol ServletRequest common methods int getcontentlength() number of bytes in the body of a request need to: access information sent as part of the request create a response that is sent back to the client When the container calls service() it passes two objects as parameters, of types: HttpServletRequest (extends ServletRequest) HttpServletResponse (extends ServletResponse) String getparameter(string name) value correspond to name or null Enumeration getparameternames() names of parameters parsed out of the request String[] getparametervalues(string name) for more than value associated with this name null if none associated Copyright UTS 2008 Servlets Servlets-27 Copyright UTS 2008 Servlets Servlets-28 HttpServletRequest methods Cookie[] getcookies() array of Cookie objects stored on the client ServletResponse methods void setcontenttype(string type) MIME type String getquerystring() query string present in the URL of GET request HttpSession getsession() HTTPSession associated with this session String getheader(string name) value associated with the name; could be null Enumeration getheadernames() an Enumeration for header names Copyright UTS 2008 Servlets Servlets-29 PrintWriter getwriter() ServletOutputStream getoutputstream() Recall Java I/O: Readers & Writers are for TEXT data InputStreams & OutputStreams are for BINARY data Thus use: getwriter() for Content-Type text/* (e.g. text/html) getoutputstream() for binary (e.g. image/gif) Copyright UTS 2008 Servlets Servlets-30

6 HttpServletResponse methods void setheader(string name, String value) modify a value for name in the response void sendredirect(string location) redirects the user s browser Complete servlet example import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class MyServlet extends HttpServlet { String encodeurl(string url) see Session void seterror(int sc) sends default error page indicating the staus code (dreaded 404) void addcookie(cookie cookie) adds a Cookie to the response public void doget ( HttpServletRequest req, HttpServletResponse res) res.setcontenttype("text/plain"); PrintWriter out = res.getwriter(); out.println("hello servlet world!"); out.close(); Copyright UTS 2008 Servlets Servlets-31 Copyright UTS 2008 Servlets Servlets-32 Using Enumerations // Example to print out all headers java.util.enumeration e = req.getheadernames(); while (e.hasmoreelements()) { String hdrname = (String) e.nextelement(); // Now we have the header name, get the header value String hdrvalue = req.getheader(hdrname); out.println(hdrname + ": " + hdrvalue); Enumerations are common be familiar with them! they're not specific to servlets though Servlets and Threading Copyright UTS 2008 Servlets Servlets-33 Copyright UTS 2008 Servlets Servlets-34 Servlets and threading By default, servlets are multi-threaded Many clients could be executing the service() method simultaneously Beware of updating shared resources from within your service() / doget() / dopost() method need to ensure synchronized access Shared resources may include: class variables (static) open files Multi-threaded servlets public class MyServlet extends HttpServlet { private static int numrequests = 0; public void doget ( HttpServletRequest req, HttpServletResponse res) incnumrequests(); //... other code goes here... private synchronized void incnumrequests() { numrequests++; Copyright UTS 2008 Servlets Servlets-35 Copyright UTS 2008 Servlets Servlets-36

7 Single-threaded servlets public class MyServlet extends HttpServlet implements SingleThreadModel { private static int numrequests = 0; public void doget ( HttpServletRequest req, HttpServletResponse res) numrequests++; //... other code goes here... SingleThreadModel Interface May send multiple requests from different threads javax.servlet.singlethread marker interface ensures that only one thread is executing service() method Approaches for SingleThreadModel servlets instance pooling maintains a pool of servlets request serialization container serializes requests DEPRECATED UNDER J2EE 1.4/5 Copyright UTS 2008 Servlets Servlets-37 Copyright UTS 2008 Servlets Servlets-38 SingleThreadModel Interface SingleThreadModel is resource intensive more object creation overhead invoke service() method in a synchronized block serialization hampers concurrent requests Avoid using SingleThreadModel in production in general, allowing your servlet to handle multiple simultaneous requests is a good thing scalability Thread-Synchronization Issues Best Practice: Reduce the scope doget() is too wide explicitly use synchronized keyword Should be aware of implications potentially blocking a container thread Eg: JDBC calls however, SingleThreadModel can help when debugging if you think simultaneous access to shared data may be the source of your bug(s) Copyright UTS 2008 Servlets Servlets-39 Copyright UTS 2008 Servlets Servlets-40 and Threading Sessions Sessions Many web sites use session-based interactions: Example: web-based application log in use web-based application log out Example: e-commerce browse online store add items to shopping cart check out and pay The web architecture does not support this HTTP is a stateless protocol Copyright UTS 2008 Servlets Servlets-41 Copyright UTS 2008 Servlets Servlets-42

8 Tracking Users Cookies URL rewriting Sessions Cookies invented by Netscape Client Respond with a Token Request with a Token Server Sessions and Cookies Cookies a small piece of text sent by the server to the client stored on the client sent by the client with all requests Example in HTTP header: Set-cookie: uid=sm; Max-age=3600; Domain=.uts.edu.au ; Path= / missing max age? discards the cookie when exit browser sends request header (uid=sm) browser stores cookie against the domain and URL path Copyright UTS 2008 Servlets Servlets-43 Copyright UTS 2008 Servlets Servlets-44 Sessions and Cookies RFC 2109 recommends at least 300 cookies with 4096 bytes per cookie 20 cookies per site limited browsers can store 20 cookies Browser to keep the cookie or discard it Decision to send cookie with a request the host must match path on the host must match the path on the cookie date time limit not expired Sessions and Cookies Creating a Cookie Cookie mycookie = new Cookie( cookie name, 64 ) Adding a cookie response.addcookie(mycookie) Getting Cookies Cookie[] cookies = request.getcookies() Setting the age mycookie.setmaxage(3600) Copyright UTS 2008 Servlets Servlets-45 Copyright UTS 2008 Servlets Servlets-46 Sessions and URL rewriting URL rewriting: way of dealing with clients who do not accept cookies adding a session identifier to the end of the URL this id is passed along with clicks on any links URL rewriting cannot be enforced on static HTML pages Sites often use both cookies & URL rewriting if cookies not supported, revert to URL rewriting Only lasts for the scope of the session Session Tracking with HttpSession Cookies store session information on the client privacy issues limit Session tracking keeps information on the server Every session is given a unique session id Technically (WLS specific) WLS creates temporary cookies this cookie is sent along with each request WLS maps the session id to the HTTPSession object HttpSession allows you to store named attributes associated with the current session Copyright UTS 2008 Servlets Servlets-47 Copyright UTS 2008 Servlets Servlets-48

9 Session Tracking with HttpSession Accessing the current session HttpSession s = req.getsession(); Storing session data ShopCart cart = new ShopCart(); // ShopCart is my own class s.setattribute( usercart, cart); Retrieving an object from a session ShopCart mycart = (ShopCart) s.getattribute( usercart ); Session Tracking with HttpSession Example usage pattern for sessions: HttpSession sess = req.getsession(); ShopCart cart; cart = (ShopCart) sess.getattribute("usercart"); if (sess.isnew() cart == null) { cart = new ShopCart(); sess.setattribute("usercart", cart); Setting the expiry time on a session s.setmaxinactiveinterval(1800); // 30 minutes Copyright UTS 2008 Servlets Servlets-49 Copyright UTS 2008 Servlets Servlets-50 Sessions and cookies Using HTTP sessions is more common than using cookies cookies are more low-level are active for a short period of time Disposes of HTTPSession object once it timed-out Use Sessions for: tracking user shopping cart caching data that user might look more than once Cookies for: recognize a user without requiring to log on Copyright UTS 2008 Servlets Servlets-51 and Threading Request forwarding and including Copyright UTS 2008 Servlets Servlets-52 Request dispatching Sometimes in a servlet, you might want to: Redirect (forward) a request to another page maybe to a servlet, JSP or HTML page Include the contents of a page in your servlet's output maybe include a static page, or the output of another servlet A RequestDispatcher provides these facilities Using "forwarding" public void doget ( HttpServletRequest req, HttpServletResponse res) ServletContext ctx = getservletcontext(); RequestDispatcher dispatcher = ctx.getrequestdispatcher("/help.html"); if (dispatcher!= null) { dispatcher.forward(req, res); return; Copyright UTS 2008 Servlets Servlets-53 Copyright UTS 2008 Servlets Servlets-54

10 Notes on forwarding The forwarding is done at the server-side, behind-the-scenes Using "including" public void doget ( HttpServletRequest req, HttpServletResponse res) Can only forward if your servlet has not generated output to the browser IllegalStateException thrown if output has been sent Use reset() if you have buffered output but not sent! You could conditionally forward depending on the value of one of the input parameters Classic Example: redirect a user to login page if user s session in invalid ServletContext ctx = getservletcontext(); RequestDispatcher dispatcher = ctx.getrequestdispatcher("/head.inc"); if (dispatcher!= null) { dispatcher.include(req, res); return; Copyright UTS 2008 Servlets Servlets-55 Copyright UTS 2008 Servlets Servlets-56 Notes on including Code is nearly identical to forwarding except call RequestDispatcher.include() Including may be done anywhere in your servlet even if some output has already been generated and Threading Filters Copyright UTS 2008 Servlets Servlets-57 Copyright UTS 2008 Servlets Servlets-58 Filters In Servlet specification v.2.3; J2EE 1.3 You can filter inbound HTTP requests Only limited to Web container Similar to servlet - container managed object Can customize how HTTP requests are handled Filters Uses: validate HTTP requests log HTTP requests authorize HTTP requests content management custom HTTP environment for servlets and JSPs HTTP Request Filter-1 HTTP Response Filter chain Filter-1 Filter-1 Web Resources Static: HTML, Images etc. Dynamic: Servlet/JSP Copyright UTS 2008 Servlets Servlets-59 Copyright UTS 2008 Servlets Servlets-60

11 Filter example public class MyFilter implements Filter { public void init(filterconfig config) {... public void dofilter (ServletRequest req, ServletResponse res, FilterChain chain) //... other code goes here chain.dofilter(request, response); public void destroy() {... and Threading Servlet/WLS issues Copyright UTS 2008 Servlets Servlets-61 Copyright UTS 2008 Servlets Servlets-62 Servlet/Weblogic Issues Define the servlet as a public class Use invalidate() to cancel a session (eg: logout) Session consumes resources! keep inactive intervals short! Cookies are not appropriate for sensitive data use database! Always activate URL rewriting To deal with paranoid users who turn off cookies Servlet/Weblogic Issues public void doget (HttpServletRequest req, HttpServletResponse res) res.setcontenttype("text/plain"); PrintWriter out = res.getwriter(); out.println("hello servlet world!"); //out.close(); Note that we didn t close or flush the writer allows WLS to keep open the socket uses a feature of HTTP 1.1 called Keep-Alive more efficient a web page may include images, sounds etc. Copyright UTS 2008 Servlets Servlets-63 Copyright UTS 2008 Servlets Servlets-64 and Threading Web Application deployment Web applications A "web application" consists of: static HTML files static CSS stylesheet files static image (GIF, JPEG) files any other static files Java servlets JSP files (Java Server Pages) Java class libraries (typically in JAR files) a deployment descriptor (web.xml) describing the application Copyright UTS 2008 Servlets Servlets-65 Copyright UTS 2008 Servlets Servlets-66

12 Servlet deployment may be deployed as either: 1. individual files (aka exploded directory ) 2. a WAR file Web Application Archive 1. Individual files good for debugging don't have to constantly rebuild/redeploy WAR file 2. WAR file good for production WAR files are portable between J2EE-compliant web servers Web Archive (WAR) file layout HelloWorldApp.war index.html WEB-INF web.xml subdirs weblogic.xml classes lib Other files Put web files at top level directory eg: html, css, gif etc HelloWorldServlet.class..any jar files needed.. deployment descriptors go here servlets, utility classes, javabeans go here java libraries Any subdirectory here will appear as a subdirectory on the URL Copyright UTS 2008 Servlets Servlets-67 Copyright UTS 2008 Servlets Servlets-68 Sample deployment directory /index.html /aboutus.html /mystyles.css /images/logo.gif /images/banner.gif /WEB-INF/web.xml /WEB-INF/classes/MyServlet.class /WEB-INF/classes/MyFilter.class /WEB-INF/lib/jstl.jar WAR files WAR files are special zip archives represents a virtual directory Looks like previous slide Use jar command from Java SDK to create them Eg: cd src jar cvf../myapp.war * Copyright UTS 2008 Servlets Servlets-69 Copyright UTS 2008 Servlets Servlets-70 WAR file WAR files contain special directory: WEB-INF It is case-sensitive and contains: /WEB-INF/web.xml deployment descriptor file required! /WEB-INF/classes/* Java class files for servlets, filters and utility classes /WEB-INF/lib/*.jar Java Archive (JAR) files containing classes Deployment descriptor web.xml file is a deployment descriptor Tells the web server about this web application a key to the portability of WAR files between servers May contain: name of the application welcome file for the application (if not index.html) error documents to display (e.g. in case of 404) list of servlets in this application how to map from URL requests to servlet invocation Copyright UTS 2008 Servlets Servlets-71 Copyright UTS 2008 Servlets Servlets-72

13 web.xml without servlets <web-app> <display-name> My First Application</display-name> This is the default web pages to display. <welcome-file-list> Can also be servlet-mapping or JSP. <welcome-file> start.html</welcome-file> <welcome-file> index.html</welcome-file> </welcome-file-list> You can define your own error pages <error-page> here (eg: 404 not found) <error-code> 404</error-code> <location> /404.html</location> </error-page> </web-app> <web-app> <servlet> web.xml with one servlet Repeat <servlet> & <servlet-mapping> block for each servlet <servlet-name> MyFirstServlet</servlet-name> <servlet-class> MyServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name> MyFirstServlet</servlet-name> <url-pattern> /home/welcome</url-pattern> </servlet-mapping> </web-app> Copyright UTS 2008 Servlets Servlets-73 Copyright UTS 2008 Servlets Servlets-74 web.xml with a filter <web-app> <filter> <filter-name> MyFirstFilter</filter-name> <filter-class> MyFilter</filter-class> </filter> This filter runs MyFilter on EVERY html file requested. <filter-mapping> <filter-name> MyFirstFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> </web-app> Servlet initialisation parameters <servlet> <servlet-name> MyFirstServlet</servlet-name> <servlet-class> MyServlet</servlet-class> <init-param> <param-name> favecolour</param-name> <param-value> Blue</param-name> </init-param> </servlet> init-param's can be retrieved in your servlet: String colour = getinitparameter("favecolour"); Copyright UTS 2008 Servlets Servlets-75 Copyright UTS 2008 Servlets Servlets-76 Actual deployment As individual files: just copy your files into the correct directory web server checks periodically for file modifications and will reload the servlet classes when changed As a WAR file: dependent upon the web server! WebLogic only: copy the WAR file into autodeploy directory or- choose 'Install a new Web Application' in the WebLogic server console uploading a new WAR file overwrites the previous one Copyright UTS 2008 Servlets Servlets-77 Summary are for presentation logic create HTML efficient yet powerful mechanism API is relatively simple once you get used to it Application support in the form of: Session management Request forwarding and inclusion Portable deployment of web applications through WAR files and deployment descriptors Copyright UTS 2008 Servlets Servlets-78

14 References Official reference (Sun) Specific to WebLogic: API reference Copyright UTS 2008 Servlets Servlets-79

Servlet Fudamentals. Celsina Bignoli

Servlet Fudamentals. Celsina Bignoli Servlet Fudamentals Celsina Bignoli bignolic@smccd.net What can you build with Servlets? Search Engines E-Commerce Applications Shopping Carts Product Catalogs Intranet Applications Groupware Applications:

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

Enterprise Java Unit 1- Chapter 4 Prof. Sujata Rizal Servlet API and Lifecycle

Enterprise Java Unit 1- Chapter 4 Prof. Sujata Rizal Servlet API and Lifecycle Introduction Now that the concept of servlet is in place, let s move one step further and understand the basic classes and interfaces that java provides to deal with servlets. Java provides a servlet Application

More information

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests What is the servlet? Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

More information

Java Servlets. Preparing your System

Java Servlets. Preparing your System Java Servlets Preparing to develop servlets Writing and running an Hello World servlet Servlet Life Cycle Methods The Servlet API Loading and Testing Servlets Preparing your System Locate the file jakarta-tomcat-3.3a.zip

More information

4.1 The Life Cycle of a Servlet 4.2 The Java Servlet Development Kit 4.3 The Simple Servlet: Creating and compile servlet source code, start a web

4.1 The Life Cycle of a Servlet 4.2 The Java Servlet Development Kit 4.3 The Simple Servlet: Creating and compile servlet source code, start a web UNIT - 4 Servlet 4.1 The Life Cycle of a Servlet 4.2 The Java Servlet Development Kit 4.3 The Simple Servlet: Creating and compile servlet source code, start a web browser and request the servlet, example

More information

Servlets and JSP (Java Server Pages)

Servlets and JSP (Java Server Pages) Servlets and JSP (Java Server Pages) XML HTTP CGI Web usability Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Servlets Generic Java2EE API for invoking and connecting to mini-servers (lightweight,

More information

UNIT-V. Web Servers: Tomcat Server Installation:

UNIT-V. Web Servers: Tomcat Server Installation: UNIT-V Web Servers: The Web server is meant for keeping Websites. It Stores and transmits web documents (files). It uses the HTTP protocol to connect to other computers and distribute information. Example:

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

JAVA SERVLET. Server-side Programming INTRODUCTION

JAVA SERVLET. Server-side Programming INTRODUCTION JAVA SERVLET Server-side Programming INTRODUCTION 1 AGENDA Introduction Java Servlet Web/Application Server Servlet Life Cycle Web Application Life Cycle Servlet API Writing Servlet Program Summary 2 INTRODUCTION

More information

SERVLETS INTERVIEW QUESTIONS

SERVLETS INTERVIEW QUESTIONS SERVLETS INTERVIEW QUESTIONS http://www.tutorialspoint.com/servlets/servlets_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Servlets Interview Questions have been designed especially

More information

Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013

Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013 Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013 Overview Dynamic web content genera2on (thus far) CGI Web server modules Server- side scrip2ng e.g. PHP, ASP, JSP Custom web server Java

More information

Introduction to JSP and Servlets Training 5-days

Introduction to JSP and Servlets Training 5-days QWERTYUIOP{ Introduction to JSP and Servlets Training 5-days Introduction to JSP and Servlets training course develops skills in JavaServer Pages, or JSP, which is the standard means of authoring dynamic

More information

Servlets Basic Operations

Servlets Basic Operations Servlets Basic Operations Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu/~spring Overview Preparing to

More information

&' () - #-& -#-!& 2 - % (3" 3 !!! + #%!%,)& ! "# * +,

&' () - #-& -#-!& 2 - % (3 3 !!! + #%!%,)& ! # * +, ! "# # $! " &' ()!"#$$&$'(!!! ($) * + #!,)& - #-& +"- #!(-& #& #$.//0& -#-!& #-$$!& 1+#& 2-2" (3" 3 * * +, - -! #.// HttpServlet $ Servlet 2 $"!4)$5 #& 5 5 6! 0 -.// # 1 7 8 5 9 2 35-4 2 3+ -4 2 36-4 $

More information

Questions and Answers

Questions and Answers Q.1) Servlet mapping defines A. An association between a URL pattern and a servlet B. An association between a URL pattern and a request page C. An association between a URL pattern and a response page

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web Introduction to Java Servlets James Baldo Jr. SWE 432 Design and Implementation of Software for the Web Web Applications A web application uses enabling technologies to 1. make web site contents dynamic

More information

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4 CMPUT 391 Database Management Systems The Basic Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

Session 9. Introduction to Servlets. Lecture Objectives

Session 9. Introduction to Servlets. Lecture Objectives Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the

More information

Session 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes

Session 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes Session 8 Deployment Descriptor 1 Reading Reading and Reference en.wikipedia.org/wiki/http Reference http headers en.wikipedia.org/wiki/list_of_http_headers http status codes en.wikipedia.org/wiki/_status_codes

More information

Advanced Web Technology

Advanced Web Technology Berne University of Applied Sciences Dr. E. Benoist Winter Term 2005-2006 Presentation 1 Presentation of the Course Part Java and the Web Servlet JSP and JSP Deployment The Model View Controler (Java Server

More information

Table of Contents. Introduction... xxi

Table of Contents. Introduction... xxi Introduction... xxi Chapter 1: Getting Started with Web Applications in Java... 1 Introduction to Web Applications... 2 Benefits of Web Applications... 5 Technologies used in Web Applications... 5 Describing

More information

Servlets. An extension of a web server runs inside a servlet container

Servlets. An extension of a web server runs inside a servlet container Servlets What is a servlet? An extension of a web server runs inside a servlet container A Java class derived from the HttpServlet class A controller in webapplications captures requests can forward requests

More information

Enterprise Java Unit 1- Chapter 3 Prof. Sujata Rizal Introduction to Servlets

Enterprise Java Unit 1- Chapter 3 Prof. Sujata Rizal Introduction to Servlets 1. Introduction How do the pages you're reading in your favorite Web browser show up there? When you log into your favorite Web site, how does the Web site know that you're you? And how do Web retailers

More information

Advance Java. Configuring and Getting Servlet Init Parameters per servlet

Advance Java. Configuring and Getting Servlet Init Parameters per servlet Advance Java Understanding Servlets What are Servlet Components? Web Application Architecture Two tier, three tier and N-tier Arch. Client and Server side Components and their relation Introduction to

More information

Session 9. Deployment Descriptor Http. Reading and Reference. en.wikipedia.org/wiki/http. en.wikipedia.org/wiki/list_of_http_headers

Session 9. Deployment Descriptor Http. Reading and Reference. en.wikipedia.org/wiki/http. en.wikipedia.org/wiki/list_of_http_headers Session 9 Deployment Descriptor Http 1 Reading Reading and Reference en.wikipedia.org/wiki/http Reference http headers en.wikipedia.org/wiki/list_of_http_headers http status codes en.wikipedia.org/wiki/http_status_codes

More information

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets ID2212 Network Programming with Java Lecture 10 Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets Leif Lindbäck, Vladimir Vlassov KTH/ICT/SCS HT 2015

More information

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2 Java Servlets Adv. Web Technologies 1) Servlets (introduction) Emmanuel Benoist Fall Term 2016-17 Introduction HttpServlets Class HttpServletResponse HttpServletRequest Lifecycle Methods Session Handling

More information

JSP. Common patterns

JSP. Common patterns JSP Common patterns Common JSP patterns Page-centric (client-server) CLIENT JSP or Servlet CLIENT Enterprise JavaBeans SERVER DB Common JSP patterns Page-centric 1 (client-server) Page View request response

More information

Fast Track to Java EE 5 with Servlets, JSP & JDBC

Fast Track to Java EE 5 with Servlets, JSP & JDBC Duration: 5 days Description Java Enterprise Edition (Java EE 5) is a powerful platform for building web applications. The Java EE platform offers all the advantages of developing in Java plus a comprehensive

More information

SSC - Web applications and development Introduction and Java Servlet (I)

SSC - Web applications and development Introduction and Java Servlet (I) SSC - Web applications and development Introduction and Java Servlet (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics What will we learn

More information

Unit 4 - Servlet. Servlet. Advantage of Servlet

Unit 4 - Servlet. Servlet. Advantage of Servlet Servlet Servlet technology is used to create web application, resides at server side and generates dynamic web page. Before Servlet, CGI (Common Gateway Interface) was popular as a server-side programming

More information

Oracle Containers for J2EE

Oracle Containers for J2EE Oracle Containers for J2EE Servlet Developer's Guide 10g (10.1.3.1.0) B28959-01 October 2006 Oracle Containers for J2EE Servlet Developer s Guide, 10g (10.1.3.1.0) B28959-01 Copyright 2002, 2006, Oracle.

More information

An excellent explanation of how web browsers work:

An excellent explanation of how web browsers work: This is a quick refresher on the HTTP protocol. An excellent explanation of how web browsers work: http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/ See also: http://grosskurth.ca/papers/browser-refarch.pdf

More information

Unit-4: Servlet Sessions:

Unit-4: Servlet Sessions: 4.1 What Is Session Tracking? Unit-4: Servlet Sessions: Session tracking is the capability of a server to maintain the current state of a single client s sequential requests. Session simply means a particular

More information

CIS 455 / 555: Internet and Web Systems

CIS 455 / 555: Internet and Web Systems 1 Background CIS 455 / 555: Internet and Web Systems Spring, 2010 Assignment 1: Web and Application Servers Milestone 1 due February 3, 2010 Milestone 2 due February 15, 2010 We are all familiar with how

More information

HTTP and the Dynamic Web

HTTP and the Dynamic Web HTTP and the Dynamic Web How does the Web work? The canonical example in your Web browser Click here here is a Uniform Resource Locator (URL) http://www-cse.ucsd.edu It names the location of an object

More information

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps.

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps. About the Tutorial Servlets provide a component-based, platform-independent method for building Webbased applications, without the performance limitations of CGI programs. Servlets have access to the entire

More information

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22. Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native

More information

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON-

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON- Ordering Information: Advanced Java 2 Platform How to Program View the complete Table of Contents Read the Preface Download the Code Examples To view all the Deitel products and services available, visit

More information

13. Databases on the Web

13. Databases on the Web 13. Databases on the Web Requirements for Web-DBMS Integration The ability to access valuable corporate data in a secure manner Support for session and application-based authentication The ability to interface

More information

Advanced Internet Technology Lab # 4 Servlets

Advanced Internet Technology Lab # 4 Servlets Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:

More information

The Structure and Components of

The Structure and Components of Web Applications The Structure and Components of a JEE Web Application Sample Content garth@ggilmour.com The Structure t of a Web Application The application is deployed in a Web Archive A structured jar

More information

How does the Web work? HTTP and the Dynamic Web. Naming and URLs. In Action. HTTP in a Nutshell. Protocols. The canonical example in your Web browser

How does the Web work? HTTP and the Dynamic Web. Naming and URLs. In Action. HTTP in a Nutshell. Protocols. The canonical example in your Web browser How does the Web work? The canonical example in your Web browser and the Dynamic Web Click here here is a Uniform Resource Locator (URL) http://www-cse.ucsd.edu It names the location of an object on a

More information

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

This course is intended for Java programmers who wish to write programs using many of the advanced Java features. COURSE DESCRIPTION: Advanced Java is a comprehensive study of many advanced Java topics. These include assertions, collection classes, searching and sorting, regular expressions, logging, bit manipulation,

More information

Unit 5 JSP (Java Server Pages)

Unit 5 JSP (Java Server Pages) Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. It focuses more on presentation logic

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management

More information

Chapter 10 Servlets and Java Server Pages

Chapter 10 Servlets and Java Server Pages Chapter 10 Servlets and Java Server Pages 10.1 Overview of Servlets A servlet is a Java class designed to be run in the context of a special servlet container An instance of the servlet class is instantiated

More information

Module 3 Web Component

Module 3 Web Component Module 3 Component Model Objectives Describe the role of web components in a Java EE application Define the HTTP request-response model Compare Java servlets and JSP components Describe the basic session

More information

Web Based Solutions. Gerry Seidman. IAM Consulting

Web Based Solutions. Gerry Seidman. IAM Consulting Web Based Solutions Gerry Seidman Internet Access Methods seidman@iamx.com http://www.iam-there.com 212-580-2700 IAM Consulting seidman@iamx.com http://www.iamx.com 212-580-2700 (c) IAM Consulting Corp.

More information

Oracle EXAM - 1Z Java Enterprise Edition 5 Web Component Developer Certified Professional Exam. Buy Full Product

Oracle EXAM - 1Z Java Enterprise Edition 5 Web Component Developer Certified Professional Exam. Buy Full Product Oracle EXAM - 1Z0-858 Java Enterprise Edition 5 Web Component Developer Certified Professional Exam Buy Full Product http://www.examskey.com/1z0-858.html Examskey Oracle 1Z0-858 exam demo product is here

More information

Session 20 Data Sharing Session 20 Data Sharing & Cookies

Session 20 Data Sharing Session 20 Data Sharing & Cookies Session 20 Data Sharing & Cookies 1 Reading Shared scopes Java EE 7 Tutorial Section 17.3 Reference http state management www.ietf.org/rfc/rfc2965.txt Cookies Reading & Reference en.wikipedia.org/wiki/http_cookie

More information

Chapter 10 Web-based Information Systems

Chapter 10 Web-based Information Systems Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 10 Web-based Information Systems Role of the WWW for IS Initial

More information

SERVLET AND JSP FILTERS

SERVLET AND JSP FILTERS SERVLET AND JSP FILTERS FILTERS OVERVIEW Filter basics Accessing the servlet context Using initialization parameters Blocking responses Modifying responses FILTERS: OVERVIEW Associated with any number

More information

One application has servlet context(s).

One application has servlet context(s). FINALTERM EXAMINATION Spring 2010 CS506- Web Design and Development DSN stands for. Domain System Name Data Source Name Database System Name Database Simple Name One application has servlet context(s).

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

In servlet, form parsing is handled automatically. You call request.getparameter to get the value of a form parameter.

In servlet, form parsing is handled automatically. You call request.getparameter to get the value of a form parameter. In servlet, form parsing is handled automatically. You call request.getparameter to get the value of a form parameter. You can also call request.getparametervalues if the parameter appears more than once,

More information

Fast Track to Java EE

Fast Track to Java EE Java Enterprise Edition is a powerful platform for building web applications. This platform offers all the advantages of developing in Java plus a comprehensive suite of server-side technologies. This

More information

Session 9. Data Sharing & Cookies. Reading & Reference. Reading. Reference http state management. Session 9 Data Sharing

Session 9. Data Sharing & Cookies. Reading & Reference. Reading. Reference http state management. Session 9 Data Sharing Session 9 Data Sharing & Cookies 1 Reading Reading & Reference Chapter 5, pages 185-204 Reference http state management www.ietf.org/rfc/rfc2109.txt?number=2109 2 3/1/2010 1 Lecture Objectives Understand

More information

Servlet Basics. Agenda

Servlet Basics. Agenda Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life

More information

Module 4: SERVLET and JSP

Module 4: SERVLET and JSP 1.What Is a Servlet? Module 4: SERVLET and JSP A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the Hyper

More information

********************************************************************

******************************************************************** ******************************************************************** www.techfaq360.com SCWCD Mock Questions : Servlet ******************************************************************** Question No :1

More information

LearningPatterns, Inc. Courseware Student Guide

LearningPatterns, Inc. Courseware Student Guide Fast Track to Servlets and JSP Developer's Workshop LearningPatterns, Inc. Courseware Student Guide This material is copyrighted by LearningPatterns Inc. This content shall not be reproduced, edited, or

More information

Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0

Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0 Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0 QUESTION NO: 1 To take advantage of the capabilities of modern browsers that use web standards, such as XHTML and CSS, your web application

More information

Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p.

Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. Preface p. xiii Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. 11 Creating the Deployment Descriptor p. 14 Deploying Servlets

More information

CH -7 RESPONSE HEADERS

CH -7 RESPONSE HEADERS CH -7 RESPONSE HEADERS. SETTING RESPONSE HEADERS FROM SERVLET setheader(string Name, String Value) This method sets the response header with the designated name to the given value. There are two specialized

More information

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming PSD1B Advance Java Programming Unit : I-V PSD1B- Advance Java Programming 1 UNIT I - SYLLABUS Servlets Client Vs Server Types of Servlets Life Cycle of Servlets Architecture Session Tracking Cookies JDBC

More information

Java Servlets Basic Concepts and Programming

Java Servlets Basic Concepts and Programming Basic Concepts and Programming Giuseppe Della Penna Università degli Studi di L Aquila dellapenna@univaq.it http://www.di.univaq.it/gdellape This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike

More information

Database Applications Recitation 6. Project 3: CMUQFlix CMUQ s Movies Recommendation System

Database Applications Recitation 6. Project 3: CMUQFlix CMUQ s Movies Recommendation System 15-415 Database Applications Recitation 6 Project 3: CMUQFlix CMUQ s Movies Recommendation System 1 Project Objective 1. Set up a front-end website with PostgreSQL as the back-end 2. Allow users to login,

More information

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introducing Object Oriented Programming... 2 Explaining OOP concepts... 2 Objects...3

More information

Servlet And JSP. Mr. Nilesh Vishwasrao Patil, Government Polytechnic, Ahmednagar. Mr. Nilesh Vishwasrao Patil

Servlet And JSP. Mr. Nilesh Vishwasrao Patil, Government Polytechnic, Ahmednagar. Mr. Nilesh Vishwasrao Patil Servlet And JSP, Government Polytechnic, Ahmednagar Servlet : Introduction Specific Objectives: To write web based applications using servlets, JSP and Java Beans. To write servlet for cookies and session

More information

Unraveling the Mysteries of J2EE Web Application Communications

Unraveling the Mysteries of J2EE Web Application Communications Unraveling the Mysteries of J2EE Web Application Communications An HTTP Primer Peter Koletzke Technical Director & Principal Instructor Common Problem What we ve got here is failure to commun cate. Captain,

More information

Java Technologies Web Filters

Java Technologies Web Filters Java Technologies Web Filters The Context Upon receipt of a request, various processings may be needed: Is the user authenticated? Is there a valid session in progress? Is the IP trusted, is the user's

More information

JAVA SERVLET. Server-side Programming ADVANCED FEATURES

JAVA SERVLET. Server-side Programming ADVANCED FEATURES JAVA SERVLET Server-side Programming ADVANCED FEATURES 1 AGENDA RequestDispacher SendRedirect ServletConfig ServletContext ServletFilter SingleThreadedModel Events and Listeners Servlets & Database 2 REQUESTDISPATCHER

More information

Web Application Architecture (based J2EE 1.4 Tutorial)

Web Application Architecture (based J2EE 1.4 Tutorial) Web Application Architecture (based J2EE 1.4 Tutorial) Dr. Kanda Runapongsa (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Web application, components and container

More information

3. WWW and HTTP. Fig.3.1 Architecture of WWW

3. WWW and HTTP. Fig.3.1 Architecture of WWW 3. WWW and HTTP The World Wide Web (WWW) is a repository of information linked together from points all over the world. The WWW has a unique combination of flexibility, portability, and user-friendly features

More information

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes Java CORE JAVA Core Java Programing (Course Duration: 40 Hours) Introduction to Java What is Java? Why should we use Java? Java Platform Architecture Java Virtual Machine Java Runtime Environment A Simple

More information

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format. J2EE Development Detail: Audience www.peaksolutions.com/ittraining Java developers, web page designers and other professionals that will be designing, developing and implementing web applications using

More information

Construction d Applications Réparties / Master MIAGE

Construction d Applications Réparties / Master MIAGE Construction d Applications Réparties / Master MIAGE HTTP and Servlets Giuseppe Lipari CRiSTAL, Université de Lille February 24, 2016 Outline HTTP HTML forms Common Gateway Interface Servlets Outline HTTP

More information

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a

More information

ServletConfig Interface

ServletConfig Interface ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from

More information

SNS COLLEGE OF ENGINEERING, Coimbatore

SNS COLLEGE OF ENGINEERING, Coimbatore SNS COLLEGE OF ENGINEERING, Coimbatore 641 107 Accredited by NAAC UGC with A Grade Approved by AICTE and Affiliated to Anna University, Chennai IT6503 WEB PROGRAMMING UNIT 04 APPLETS Java applets- Life

More information

Introduction to Web applications with Java Technology 3- Servlets

Introduction to Web applications with Java Technology 3- Servlets Introduction to Web applications with Java Technology 3- Servlets Juan M. Gimeno, Josep M. Ribó January, 2008 Contents Introduction to web applications with Java technology 1. Introduction. 2. HTTP protocol

More information

Topics Augmenting Application.cfm with Filters. What a filter can do. What s a filter? What s it got to do with. Isn t it a java thing?

Topics Augmenting Application.cfm with Filters. What a filter can do. What s a filter? What s it got to do with. Isn t it a java thing? Topics Augmenting Application.cfm with Filters Charles Arehart Founder/CTO, Systemanage carehart@systemanage.com http://www.systemanage.com What s a filter? What s it got to do with Application.cfm? Template

More information

The Servlet Life Cycle

The Servlet Life Cycle The Servlet Life Cycle What is a servlet? Servlet is a server side component which receives a request from a client, processes the request and sends a content based response back to the client. The Servlet

More information

Enterprise Java and Rational Rose - Part II

Enterprise Java and Rational Rose - Part II Enterprise Java and Rational Rose - Part II by Khawar Ahmed Technical Marketing Engineer Rational Software Loïc Julien Software Engineer Rational Software This is the second installment of a twopart series

More information

Generating the Server Response: HTTP Response Headers

Generating the Server Response: HTTP Response Headers Generating the Server Response: HTTP Response Headers 1 Agenda Format of the HTTP response Setting response headers Understanding what response headers are good for Building Excel spread sheets Generating

More information

Chapter 17. Web-Application Development

Chapter 17. Web-Application Development Chapter 17. Web-Application Development Table of Contents Objectives... 1 17.1 Introduction... 1 17.2 Examples of Web applications... 2 17.2.1 Blogs... 2 17.2.2 Wikis... 2 17.2.3 Sakai... 3 17.2.4 Digital

More information

web.xml Deployment Descriptor Elements

web.xml Deployment Descriptor Elements APPENDIX A web.xml Deployment Descriptor s The following sections describe the deployment descriptor elements defined in the web.xml schema under the root element . With Java EE annotations, the

More information

Using Java servlets to generate dynamic WAP content

Using Java servlets to generate dynamic WAP content C H A P T E R 2 4 Using Java servlets to generate dynamic WAP content 24.1 Generating dynamic WAP content 380 24.2 The role of the servlet 381 24.3 Generating output to WAP clients 382 24.4 Invoking a

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Structure of a webapplication

Structure of a webapplication Structure of a webapplication Catalogue structure: / The root of a web application. This directory holds things that are directly available to the client. HTML-files, JSP s, style sheets etc The root is

More information

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java. [Course Overview] The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming,

More information

Java E-Commerce Martin Cooke,

Java E-Commerce Martin Cooke, Java E-Commerce Martin Cooke, 2002 1 Plan The web tier: servlets life cycle Session-management TOMCAT & ANT Applet- communication The servlet life-cycle Notes based largely on Hunter & Crawford (2001)

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

Server and WebLogic Express

Server and WebLogic Express BEAWebLogic Server and WebLogic Express Programming WebLogic HTTP Servlets Version 8.1 Revised: February 21, 2003 Copyright Copyright 2003 BEA Systems, Inc. All Rights Reserved. Restricted Rights Legend

More information

Handout 31 Web Design & Development

Handout 31 Web Design & Development Lecture 31 Session Tracking We have discussed the importance of session tracking in the previous handout. Now, we ll discover the basic techniques used for session tracking. Cookies are one of these techniques

More information

UNIT-VI. HttpServletResponse It extends the ServletResponse interface to provide HTTP-specific functionality in sending a response.

UNIT-VI. HttpServletResponse It extends the ServletResponse interface to provide HTTP-specific functionality in sending a response. UNIT-VI javax.servlet.http package: The javax.servlet.http package contains a number of classes and interfaces that describe and define the contracts between a Servlet class running under the HTTP protocol

More information