Servletek, J2EE. Több réteg! architektúrák
|
|
- Alan Bryant
- 6 years ago
- Views:
Transcription
1 Servletek, J2EE 2 Több réteg! architektúrák Kommunikációs minták Client- Server 3-Tier Web Application Web Services Hybrid P2P Fractal
2 3 Web alkalmazások Business Systems DB Server App Server Web Server Browser Client J2EE J2SE/ J2ME Web Application 4 Web services Bus. Sys. DB App Web Browser XML (UDDI, SOAP) Context and Identity (LDAP, Policy, Liberty) J2EE J2SE/ J2ME Web Service
3 5 Servletek dinamikus html tartalom generálás üzleti alkalmazás web interfészének kialakítása servletek Java technológia webszerver kiterjesztése 6 Servletek vs. CGI Servlet el!nyök Hatékonyság Kényelem Platform és szerver független Session management Request Request CGI1 CGI1 Biztonságos Request CGI2 Request CGI2 Request Request CGI1 CGI1 CGI CGI Based Webserver Child Child for for CGI1 CGI1 Child Child for for CGI2 CGI2 Child Child for for CGI1 CGI1 Request Request Servlet1 Servlet1 Request Request Servlet2 Servlet2 Request Servlet1 Servlet Servlet Based Based Webserver Webserver Servlet1 Servlet1 JVM JVM Servlet2 Servlet2
4 7 J2EE konténerek Komponensek végrehajtási környezete Egyszer" API Transzparensek Enterprise API biztosítása Applet Container Web Container EJB Container Applet HTTP/ JSP Servlet EJB HTTPS RMI J2SE App Client Container App Client HTTP/ HTTPS JNDI J2SE RMI JNDI JMS RMI/IIOP JMS JDBC JTA JavaMail JAF RMI/IIOP JDBC JNDI JMS JTA JavaMail JAF RMI/IIOP JDBC J2SE J2SE Database 76 8 Servlet m!ködése Server Machine Servlet Java Class Client Machine Web Browser HTML doget or dopost HTML Web Server Init Service HTML HTML doget dopost Destroy
5 9 Servlet osztályok Servlet Basic Servlet Layer Method: service ServletRequest ServletResponse HttpServlet Methods: Service doget dopost init destroy etc. Http Servlet Layer HttpServletRequest HttpServletResponse MyServlet Methods: doget dopost init destroy etc. Your Servlet Code 10 doget, dopost public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException public void doput(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException HttpServletRequest kérés paraméterei, http fejléc mez!k, post adatok HttpServletResponse válasz fejléc, html tartalom
6 11 Servlet output public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title>first Servlet program</title></head>"); out.println("<body>"); out.println("<h1>welcome to Servlets</H1>"); out.println("</body>"); out.println("</html>"); out.close(); 12 Servlet konténerek Apache Tomcat (referencia implementáció) Allaire JRun Gefion LiteWebServer Sun Java Web Server
7 13 Servlet kód template import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ServletTemplate extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Use "request" to read incoming HTTP headers // (e.g. cookies) and HTML form data (e.g. data the user // entered and submitted). // Use "response" to specify the HTTP response status // code and headers (e.g. the content type, cookies). PrintWriter out = response.getwriter(); // Use "out" to send content to browser 14 Servlet példa import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head>"); out.println("<title>hola</title>"); out.println("</head>"); out.println("<body bgcolor=\"white\">"); out.println("<h1> Hi </h1>"); out.println("</body>"); out.println("</html>");
8 15 A servlet telepítése Context web application <inst.dir>/conf/server.xml <inst.dir>/webapps dir mine mine/web-inf mine/web-inf/classes mine/web-inf/lib mine/web-inf/web.xml <inst.dir>/tomcat-docs/appdev/ web.xml.txt 16 web.xml <display-name>my Web Application</display-name> <description> Examples by Me </description> [...] <context-param> <param-name>webmaster</param-name> <param-value>your@ .address</param-value> <description> The address of the administrator to whom questions and comments about this application should be addressed. </description> </context-param> <servlet> <servlet-name>hi</servlet-name> <description> Testing </description> <servlet-class>hi</servlet-class> </servlet> <servlet-mapping> <servlet-name>hi</servlet-name> <url-pattern>/hi</url-pattern> </servlet-mapping>
9 17 Servlet életciklus // load the servlet class and setup request, response objects Servlet servlet = ServletRequest request = ServletResponse response = // initialise servlet ServletConfig config = servlet.getservletconfig(); servlet.init(config); // service zero or more requests while ( more requests ) // invoke servlet to process request servlet.service(request, service); Call to methods doget(), dopost() in the user defined servlet class // cleanup after service servlet.destroy(); Unlike CGI a single servlet can service several requests. In CGI, server invokes a separate process for each request. Servlets therefore reduce server load CCTM: Course material developed by James King (james.king@londonmet.ac.uk) 18 Inicializálás import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Example using servlet initialization. Here, the message * to print and the number of times the message should be * repeated is taken from the init parameters. */ public class ShowMessage extends HttpServlet { private String message; private String defaultmessage = "No message."; private int repeats = 1; public void init(servletconfig config) throws ServletException { // Always call super.init super.init(config); message = config.getinitparameter("message"); if (message == null) { message = defaultmessage; try { String repeatstring = config.getinitparameter("repeats"); repeats = Integer.parseInt(repeatString); catch(numberformatexception nfe) { // NumberFormatException handles case where repeatstring // is null *and* case where it is something in an // illegal format. Either way, do nothing in catch, // as the previous value (1) for the repeats field will // remain valid because the Integer.parseInt throws // the exception *before* the value gets assigned // to repeats. <?xml version="1.0" encoding="iso "?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2// EN" " <web-app> <servlet> <servlet-name> ShowMsg </servlet-name> <servlet-class> coreservlets.showmessage </servlet-class> <init-param> <param-name> message </param-name> <param-value> Shibboleth </param-value> </init-param> <init-param> <param-name> repeats </param-name> <param-value> 5 </param-value> </init-param> </servlet> </web-app> web.xml
10 19 Inicializálás (példa) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Example using servlet initialization and the * getlastmodified method. */ public class LotteryNumbers extends HttpServlet { private long modtime; private int[] numbers = new int[10]; /** The init method is called only when the servlet * is first loaded, before the first request * is processed. */ public void init() throws ServletException { // Round to nearest second (ie 1000 milliseconds) modtime = System.currentTimeMillis()/1000*1000; for(int i=0; i<numbers.length; i++) { numbers[i] = randomnum(); public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "Your Lottery Numbers"; out.println(servletutilities.headwithtitle(title) +"<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=CENTER>" + title + "</H1>\n" + "<B>Based upon extensive research of " + "astro-illogical trends, psychic farces, " + "and detailed statistical claptrap, " + "we have chosen the " + numbers.length + " best lottery numbers for you.</b>" + "<OL>"); for(int i=0; i<numbers.length; i++) { out.println(" <LI>" + numbers[i]); out.println("</ol>" + "</BODY></HTML>"); 20 Inicializálás (példa folyt.) /** The standard service method compares this date * against any date specified in the If-Modified-Since * request header. If the getlastmodified date is * later, or if there is no If-Modified-Since header, * the doget method is called normally. But if the * getlastmodified date is the same or earlier, * the service method sends back a 304 (Not Modified) * response, and does <B>not</B> call doget. * The browser should use its cached version of * the page in such a case. */ public long getlastmodified(httpservletrequest request) { return(modtime); // A random int from 0 to 99. private int randomnum() { return((int)(math.random() * 100));
11 21 HttpServletRequest osztály String getmethod() obtain the HTTP request is it a GET or POST String getparameter(string name) - get a parameter (covered later) String getremotehost() - client s host name String getremoteaddr() - IP address of client String getservername() - servers name int getserverport() - port on which server was initially contacted on (8080 is usually intranet only and not accessible from outside) String getheader("user-agent") - name of client s web browser String getheader("referer") - URL of page that called the servlet some more methods HttpServletRequest példa import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ServEnvData extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title>environment Data</TITLE></HEAD>"); out.println("<body>"); out.println("<h1>servlet Environment</H1>"); out.println("<b>method:</b>"+request.getmethod()+"<br>"); out.println("<b>client Host:</B>"+request.getRemoteHost()+"<BR>"); out.println("<b>client's IP Address:</B>"+request.getRemoteAddr()+"<BR>"); out.println("<b>server Name:</B>"+request.getServerName()+"<BR>"); out.println("<b>server Port:</B>"+request.getServerPort()+"<BR>"); out.println("<b>client's Browser:</B>"+request.getHeader("User-Agent")+"<BR>"); out.println("<b>client's URL:</B>"+request.getHeader("Referer")+"<BR>"); out.println("</body>"); out.println("</html>"); out.close();
12 23 HttpServletRequest példa (folyt.) 24 HttpServletResponse osztály void response.addcookie(cookie cookie) void response.senderror(int status) - standard HTTP status codes void response.sendstatus(int status) - send HTTP status codes that are not errors void response.sendredirect(string location) - sends a redirect response to the client some more methods...
13 25 URL és form paraméterek <a href=" click here for a parameter example! </a> String parameter=request.getparameter("p1"); <a href=" p1=hello&p2=goodbye"> click here for a parameter example! </a> Enumeration p=request.getparameternames(); while (p.hasmoreelements()) { String n=(string)p.nextelement(); String v=request.getparameter(n); out.println("parameter name is "+n+" parameter value" +v+"<br>"); 26 Kiszolgálás több szálon servlet meghívása konkurrens kérésekb!l globális változók kezelése?
14 27 Nem megfelel" megoldás (pl.) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class multi extends HttpServlet { int count=0; public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title> Thread UNSAFE example </TITLE> </HEAD> "); out.println("<body>"); out.println("<h1> old count is "+count+"</h1>"); count=count+1; try { Thread.sleep(4000); catch (Exception e) { out.println("<h1> new count is "+count+"</h1>"); out.println("</body>"); out.println("</html>"); 28 Megoldások nincsenek globális adatok session és cookie kezelés tárolás kliens oldalon kritikus szakasz megvalósítás szinkronizálás
15 29 Synchronized (pl.) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class multi extends HttpServlet { int count=0; Object s=new Object(); public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title> Thread UNSAFE example </TITLE> </HEAD> "); out.println("<body>"); synchronized (s) { out.println("<h1> old count is "+count+"</h1>"); 30 Perzisztens adatok Állapot meg!rzése servlet újratöltések és inicializálások között Szerver részér!l meghatározatlan újratöltési id!pontok
16 31 Probléma (pl.) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class global extends HttpServlet { int count=0; public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title> Global Data Example </TITLE> </HEAD> "); out.println("<body>"); out.println("<h1> old count is "+count+"</h1>"); 32 Megoldás HttpServletContext attribútumok requestben elérhet!k újra fordításkor elveszik
17 33 Megoldás (pl.) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class context extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { Integer count=new Integer(0); response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head><title> Global Data Example </TITLE> </HEAD> "); out.println("<body>"); Date d=new Date(); out.println("current time is "+d); ServletContext s=getservletcontext(); count=(integer)s.getattribute("count"); if (count==null) { count=new Integer(0); s.setattribute("count",count); int c=count.intvalue(); out.println("<h1> old count is "+c+"</h1>"); c=c+1; out.println("<h1> new count is "+c+"</h1>"); count=new Integer(c); s.setattribute("count",count); out.println("</body>"); out.println("</html>"); 34 Kliens oldali állapottárolás session kliens életciklus több kérés-válasz páron keresztül szerver adminisztálja egyedi azonosító törlés, élettartam lejárta
18 35 Session ID kezelés URL generálás rejtett form mez! cookie SSL session id 36 Cookie HTML header név, érték (URL) Set-cookie: FavColours=Blue; Max-age=60; Domain=.unl.ac.uk ; Path= / ; korlátozások 20 cookie per webszerver 4 KB méret
19 37 HttpSession nagy mennyiség" struktúrált adat tárolása attribútumok Java objects HttpServletRequest 38 HttpSession (folyt.)... HttpSession s= request.getsession(true); s.setmaxinactiveinterval(60); Integer value=new Integer(0); value=(integer)s.getattribute("value"); if (value==null) { value=new Integer(0); s.setattribute("value",value); out.println("<h1> The session has id "+s.getsessionid()+"</h1>"); out.println("<h1> old value is "+value+"</h1>"); value=new Integer(value.intValue()+1); out.println("<h1> new count is "+ s.getattribute("value") +"</H1>"); s.setattribute("value",value);...
20 39 Cookie kezelés Lekérdezés public void doget(httpservletrequest request, HttpServletResponse response) {. Cookie cookie = null; Cookie[] cookies = request.getcookies(); if (cookiearr!= null) { for (int i = 0; i < cookies.length; i++) { cookie = cookies[i]; String name = cookie.getname(); if (name.equals( FavColours")) { out.println(cookie.value());. Beállítás cookie = new Cookie( FavColours, Blue ); cookie.setmaxage(600); response.addcookie(cookie); 40 Servlet debuggolás wget curl WebClient
First Servlets. Chapter. Topics in This Chapter
First Servlets Chapter Topics in This Chapter The basic structure of servlets A simple servlet that generates plain text The process of compiling, installing, and invoking servlets A servlet that generates
More informationServlet 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 informationSession 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 informationJava 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&' () - #-& -#-!& 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 informationServlets1. 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 informationAdvanced 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 informationServlet 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 informationWeb 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 informationAN OVERVIEW OF SERVLET AND JSP TECHNOLOGY
AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY Topics in This Chapter Understanding the role of servlets Building Web pages dynamically Looking at servlet code Evaluating servlets vs. other technologies Understanding
More informationSession 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 informationINTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature
INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat
More informationChapter 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 informationJAVA 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 informationAdvanced 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 informationBerner 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 informationHttpServlet ( 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 informationHandout 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 informationEnterprise 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 informationServletConfig 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 informationEnterprise 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 informationAJP. 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 informationsessionx 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 informationServlets 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********************************************************************
******************************************************************** www.techfaq360.com SCWCD Mock Questions : Servlet ******************************************************************** Question No :1
More informationServer Side Internet Programming
Server Side Internet Programming DD1335 (Lecture 6) Basic Internet Programming Spring 2010 1 / 53 Server Side Internet Programming Objectives The basics of servlets mapping and configuration compilation
More informationJava 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 informationServlets. 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 informationLecture Notes On J2EE
BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On J2EE Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. INTRODUCTION TO SERVLET Java Servlets are server side Java programs that require
More informationThe 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 informationUNIT-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 informationModule 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 information4.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 informationJava4570: Session Tracking using Cookies *
OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract
More informationSERVLETS 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 informationStateless -Session Bean
Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application
More informationIntroduction 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 informationIntroduction 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 informationThis 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 informationJavaServer Pages (JSP)
JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult
More informationIntroduction to Servlets. After which you will doget it
Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,
More informationUsing 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 informationJava 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 informationServlet and JSP Review
2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com
More informationUnit 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 informationTo 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 informationAdvance 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 informationServlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.
Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;
More informationThe 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 informationTopics. Advanced Java Programming. Quick HTTP refresher. Quick HTTP refresher. Web server can return:
Advanced Java Programming Servlets Chris Wong chw@it.uts.edu.au Orginal notes by Dr Wayne Brookes and Threading Copyright UTS 2008 Servlets Servlets-1 Copyright UTS 2008 Servlets Servlets-2 Quick HTTP
More informationChettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY
CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY UNIT IV SERVLETS 1. What is Servlets? a. Servlets are server side components that provide a powerful mechanism
More informationJSP. 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 informationSession 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 informationDatabase Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실
데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming
More informationServlet. 1.1 Web. 1.2 Servlet. HTML CGI Common Gateway Interface Web CGI CGI. Java Applet JavaScript Web. Java CGI Servlet. Java. Apache Tomcat Jetty
1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C Java Applet JavaScript Web CGI HTML 1.2 Servlet Java Servlet Servlet CGI Web CGI 1 Java Java JVM Java
More informationCHAPTER 2: A FAST INTRODUCTION TO BASIC SERVLET PROGRAMMING
Taken from More Servlets and JavaServer Pages by Marty Hall. Published by Prentice Hall PTR. For personal use only; do not redistribute. For a complete online version of the book, please see http://pdf.moreservlets.com/.
More informationQuestions 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 informationThe 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 informationHandling Cookies. Agenda
Handling Cookies 1 Agenda Understanding the benefits and drawbacks of cookies Sending outgoing cookies Receiving incoming cookies Tracking repeat visitors Specifying cookie attributes Differentiating between
More informationSERVLET 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 informationPSD1B 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 informationSSC - 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 informationServlets 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 information2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR
Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow
More informationCOMP9321 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 informationHTTP 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 informationCSC309: Introduction to Web Programming. Lecture 10
CSC309: Introduction to Web Programming Lecture 10 Wael Aboulsaadat WebServer - WebApp Communication 2. Servlets Web Browser Get servlet/serv1? key1=val1&key2=val2 Web Server Servlet Engine WebApp1 serv1
More informationUnit-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 informationGetting started with Winstone. Minimal servlet container
Getting started with Winstone Minimal servlet container What is Winstone? Winstone is a small servlet container, consisting of a single JAR file. You can run Winstone on your computer using Java, and get
More informationSupplement IV.E: Tutorial for Tomcat For Introduction to Java Programming By Y. Daniel Liang
Supplement IV.E: Tutorial for Tomcat 5.5.9 For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Obtaining and Installing Tomcat Starting and Stopping Tomcat
More informationa. 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 informationIntrodução a Servlets
Introdução a Servlets Sumário 7.1.1.Introdução 7.1.2.Servlet Overview and Architecture 7.1.2.1 Interface Servlet and the Servlet Life Cycle 7.1.2.2 HttpServlet Class 7.1.2.3 HttpServletRequest Interface
More informationHow 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 informationLAB 1 PREPARED BY : DR. AJUNE WANIS ISMAIL FACULTY OF COMPUTING UNIVERSITI TEKNOLOGI MALAYSIA
LAB 1 PREPARED BY : DR. AJUNE WANIS ISMAIL FACULTY OF COMPUTING UNIVERSITI TEKNOLOGI MALAYSIA Setting up Java Development Kit This step involves downloading an implementation of the Java Software Development
More informationCS433 Technology Overview
CS433 Technology Overview Scott Selikoff Cornell University November 13, 2002 Outline I. Introduction II. Stored Procedures III. Java Beans IV. JSPs/Servlets V. JSPs vs. Servlets VI. XML Introduction VII.
More informationSWE642 Oct. 22, 2003
import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.arraylist; DataServlet.java /** * First servlet in a two servlet application. It is responsible
More informationIntroduction 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 informationJAVA SERVLETS INTRODUCTION SERVLETS SHRI GURU RAM RAI INSTITUTE OF TECHNOLOGY & SCIENCE, DEHRADUN
JAVA SERVLETS INTRODUCTION Java servlets are programs that run on web server. Java applets are programs that are embedded into the web pages. When browser loads the web page the applets byte code is downloaded
More informationIntroduction. This course Software Architecture with Java will discuss the following topics:
Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations
More informationFast 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 informationIntroduction. Enterprise Java Instructor: Please introduce yourself Name Experience in Java Enterprise Edition Goals you hope to achieve
Enterprise Java Introduction Enterprise Java Instructor: Please introduce yourself Name Experience in Java Enterprise Edition Goals you hope to achieve Course Description This course focuses on developing
More informationIntroduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003
Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:
More informationCS506 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 informationAdvanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans
University of New York, Tirana M.Sc. Computer Science Advanced Topics in Operating Systems Manual for Lab Practices Enterprise JavaBeans PART III A Web Banking Application with EJB and MySQL Development
More informationBackend. (Very) Simple server examples
Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));
More informationDatabase 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 informationHandling Cookies. For live Java EE training, please see training courses at
Edited with the trial version of 2012 Marty To Hall remove this notice, visit: Handling Cookies Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html
More informationJ2EE Packaging and Deployment
Summary of Contents Introduction 1 Chapter 1: The J2EE Platform 9 Chapter 2: Directory Services and JNDI 39 Chapter 3: Distributed Computing Using RMI 83 Chapter 4 Database Programming with JDBC 157 Chapter
More informationLab session Google Application Engine - GAE. Navid Nikaein
Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone
More informationJdbcResultSet.java. import java.sql.*;
1)Write a program to display the current contents of the tables in the database where table name is Registration and attributes are id,firstname,lastname,age. JdbcResultSet.java import java.sql.*; public
More informationA Servlet-Based Search Engine. Introduction
A Servlet-Based Search Engine Introduction Architecture Implementation Summary Introduction Pros Suitable to be deployed as a search engine for a static web site Very efficient in dealing with client requests
More informationWelcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation
Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background
More informationLearningPatterns, 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 informationHandling the Client Request: HTTP Request Headers
Handling the Client Request: HTTP Request Headers 1 Agenda Reading HTTP request headers Building a table of all the request headers Understanding the various request headers Reducing download times by
More informationComponent Based Software Engineering
Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts
More information3 The Servlet Life Cycle
3 The Servlet Life Cycle In this chapter: The Servlet Alternative Servlet Reloading Init and Destroy Single-Thread Model Background Processing Last Modified Times The servlet life cycle is one of the most
More informationStructure 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 informationUNIT-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 informationServlets Pearson Education, Inc. All rights reserved.
1 26 Servlets 2 A fair request should be followed by the deed in silence. Dante Alighieri The longest part of the journey is said to be the passing of the gate. Marcus Terentius Varro If nominated, I will
More information