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

Size: px
Start display at page:

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

Transcription

1

2 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 family of Java APIs, including the JDBC API to access enterprise databases. This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps. Audience This tutorial is designed for Java programmers with a need to understand the Java Servlets framework and its APIs. After completing this tutorial you will find yourself at a moderate level of expertise in using Java Servlets from where you can take yourself to next levels. Prerequisites We assume you have good understanding of the Java programming language. It will be great if you have a basic understanding of web application and how internet works. Copyright & Disclaimer Copyright 2015 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of the contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness, or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at contact@tutorialspoint.com i

3 Table of Contents About the Tutorial... i Audience... i Prerequisites... i Table of Content... ii 1. SERVLETS OVERVIEW... 1 Servlets Tasks... 2 Servlets Packages... 2 What is Next? SERVLETS ENVIRONMENT SETUP... 3 Setting up Java Development Kit... 3 Setting up Web Server: Tomcat... 3 Setting Up the CLASSPATH SERVLETS LIFE CYCLE... 7 The init() Method... 7 The service() Method... 7 The doget() Method... 8 The dopost() Method... 8 The destroy() Method... 8 Architecture Diagram SERVLETS EXAMPLES Sample Code Compiling a Servlet Servlet Deployment ii

4 5. SERVLETS FORM DATA GET Method POST Method Reading Form Data using Servlet GET Method Example using URL GET Method Example Using Form POST Method Example Using Form Passing Checkbox Data to Servlet Program Reading All Form Parameters SERVLETS CLIENT HTTP REQUEST Methods to read HTTP Header HTTP Header Request Example SERVLETS SERVER HTTP RESPONSE Methods to Set HTTP Response Header HTTP Header Response Example SERVLETS HTTP STATUS CODES Methods to Set HTTP Status Code HTTP Status Code Example SERVLETS WRITING FILTERS Servlet Filter Methods Servlet Filter Example Servlet Filter Mapping in Web.xml Using Multiple Filters Filters Application Order iii

5 10. SERVLETS EXCEPTION HANDLING web.xml Configuration Request Attributes Errors/Exceptions Error Handler Servlet Example SERVLETS COOKIES HANDLING The Anatomy of a Cookie Servlet Cookies Methods Setting Cookies with Servlet Reading Cookies with Servlet Delete Cookies with Servlet SERVLETS SESSION TRACKING Cookies Hidden Form Fields URL Rewriting The HttpSession Object Session Tracking Example Deleting Session Data SERVLETS DATABASE ACCESS Create Table Create Data Records Accessing a Database SERVLETS FILE UPLOADING Creating a File Upload Form Writing Backend Servlet Compile and Running Servlet iv

6 15. SERVLET HANDLING DATE Getting Current Date & Time Date Comparison Date Formatting using SimpleDateFormat Simple DateFormat Format Codes SERVLETS PAGE REDIRECTION SERVLETS HITS COUNTER Hit Counter for a Web Page SERVLETS AUTO PAGE REFRESH Auto Page Refresh Example SERVLETS SENDING Send a Simple Send an HTML Send Attachment in User Authentication Part SERVLETS PACKAGING Creating Servlets in Packages Compiling Servlets in Packages Packaged Servlet Deployment SERVLETS DEBUGGING System.out.println() Message Logging Using JDB Debugger Using Comments Client and Server Headers v

7 Important Debugging Tips SERVLETS INTERNATIONALIZATION Detecting Locale Languages Setting Locale Specific Dates Locale Specific Currency Locale Specific Percentage SERVLET ANNOTATIONS vi

8 1. Servlets Overview Java Servlets What are Servlets? Java Servlets are programs that run on a Web or Application server and act as a middle layer between a requests coming from a Web browser or other HTTP client and databases or applications on the HTTP server. Using Servlets, you can collect input from users through web page forms, present records from a database or another source, and create web pages dynamically. Java Servlets often serve the same purpose as programs implemented using the Common Gateway Interface (CGI). But Servlets offer several advantages in comparison with the CGI. Performance is significantly better. Servlets execute within the address space of a Web server. It is not necessary to create a separate process to handle each client request. Servlets are platform-independent because they are written in Java. Java security manager on the server enforces a set of restrictions to protect the resources on a server machine. So servlets are trusted. The full functionality of the Java class libraries is available to a servlet. It can communicate with applets, databases, or other software via the sockets and RMI mechanisms that you have seen already. Servlets Architecture The following diagram shows the position of Servlets in a Web Application. 1

9 Servlets Tasks Servlets perform the following major tasks: Read the explicit data sent by the clients (browsers). This includes an HTML form on a Web page or it could also come from an applet or a custom HTTP client program. Read the implicit HTTP request data sent by the clients (browsers). This includes cookies, media types and compression schemes the browser understands, and so forth. Process the data and generate the results. This process may require talking to a database, executing an RMI or CORBA call, invoking a Web service, or computing the response directly. Send the explicit data (i.e., the document) to the clients (browsers). This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), Excel, etc. Send the implicit HTTP response to the clients (browsers). This includes telling the browsers or other clients what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks. Servlets Packages Java Servlets are Java classes run by a web server that has an interpreter that supports the Java Servlet specification. Servlets can be created using the javax.servlet and javax.servlet.http packages, which are a standard part of the Java's enterprise edition, an expanded version of the Java class library that supports large-scale development projects. These classes implement the Java Servlet and JSP specifications. At the time of writing this tutorial, the versions are Java Servlet 2.5 and JSP 2.1. Java servlets have been created and compiled just like any other Java class. After you install the servlet packages and add them to your computer's Classpath, you can compile servlets with the JDK's Java compiler or any other current compiler. What is Next? I would take you step by step to set up your environment to start with Servlets. So fasten your belt for a nice drive with Servlets. I'm sure you are going to enjoy this tutorial very much. 2

10 2. Servlets Environment Setup Java Servlets A development environment is where you would develop your Servlet, test them and finally run them. Like any other Java program, you need to compile a servlet by using the Java compiler javac and after compilation the servlet application, it would be deployed in a configured environment to test and run. This development environment setup involves the following steps: Setting up Java Development Kit This step involves downloading an implementation of the Java Software Development Kit (SDK) and setting up PATH environment variable appropriately. You can download SDK from Oracle's Java site: Java SE Downloads. Once you download your Java implementation, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively. If you are running Windows and installed the SDK in C:\jdk1.8.0_65, you would put the following line in your C:\autoexec.bat file. set PATH=C:\jdk1.8.0_65\bin;%PATH% set JAVA_HOME=C:\jdk1.8.0_65 Alternatively, on Windows NT/2000/XP, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the PATH value and press the OK button. On Unix (Solaris, Linux, etc.), if the SDK is installed in /usr/local/jdk1.8.0_65 and you use the C shell, you would put the following into your.cshrc file. setenv PATH /usr/local/jdk1.8.0_65/bin:$path setenv JAVA_HOME /usr/local/jdk1.8.0_65 Alternatively, if you use an Integrated Development Environment (IDE) like Borland JBuilder, Eclipse, IntelliJ IDEA, or Sun ONE Studio, compile and run a simple program to confirm that the IDE knows where you installed Java. Setting up Web Server: Tomcat A number of Web Servers that support servlets are available in the market. Some web servers are freely downloadable and Tomcat is one of them. 3

11 Apache Tomcat is an open source software implementation of the Java Servlet and Java Server Pages technologies and can act as a standalone server for testing servlets and can be integrated with the Apache Web Server. Here are the steps to setup Tomcat on your machine: Download latest version of Tomcat from Once you downloaded the installation, unpack the binary distribution into a convenient location. For example in C:\apache-tomcat on windows, or /usr/local/apache-tomcat on Linux/Unix and create CATALINA_HOME environment variable pointing to these locations. Tomcat can be started by executing the following commands on windows machine: %CATALINA_HOME%\bin\startup.bat or C:\apache-tomcat \bin\startup.bat Tomcat can be started by executing the following commands on Unix (Solaris, Linux, etc.) machine: $CATALINA_HOME/bin/startup.sh or /usr/local/apache-tomcat /bin/startup.sh After startup, the default web applications included with Tomcat will be available by visiting If everything is fine then it should display following result: 4

12 Further information about configuring and running Tomcat can be found in the documentation included here, as well as on the Tomcat web site: Tomcat can be stopped by executing the following commands on windows machine: C:\apache-tomcat \bin\shutdown Tomcat can be stopped by executing the following commands on Unix (Solaris, Linux, etc.) machine: /usr/local/apache-tomcat /bin/shutdown.sh Setting Up the CLASSPATH Since servlets are not part of the Java Platform, Standard Edition, you must identify the servlet classes to the compiler. If you are running Windows, you need to put the following lines in your C:\autoexec.bat file. set CATALINA=C:\apache-tomcat set CLASSPATH=%CATALINA%\common\lib\servlet-api.jar;%CLASSPATH% Alternatively, on Windows NT/2000/XP, you could go to My Computer -> Properties -> Advanced -> Environment Variables. Then, you would update the CLASSPATH value and press the OK button. On Unix (Solaris, Linux, etc.), if you are using the C shell, you would put the following lines into your.cshrc file. setenv CATALINA=/usr/local/apache-tomcat

13 setenv CLASSPATH $CATALINA/common/lib/servlet-api.jar:$CLASSPATH NOTE: Assuming that your development directory is C:\ServletDevel (Windows) or /usr/servletdevel (Unix) then you would need to add these directories as well in CLASSPATH in similar way as you have added above. 6

14 3. Servlets Life Cycle Java Servlets A servlet life cycle can be defined as the entire process from its creation till the destruction. The following are the paths followed by a servlet The servlet is initialized by calling the init () method. The servlet calls service() method to process a client's request. The servlet is terminated by calling the destroy() method. Finally, servlet is garbage collected by the garbage collector of the JVM. Now let us discuss the life cycle methods in detail. The init() Method The init method is called only once. It is called only when the servlet is created, and not called for any user requests afterwards. So, it is used for one-time initializations, just as with the init method of applets. The servlet is normally created when a user first invokes a URL corresponding to the servlet, but you can also specify that the servlet be loaded when the server is first started. When a user invokes a servlet, a single instance of each servlet gets created, with each user request resulting in a new thread that is handed off to doget or dopost as appropriate. The init() method simply creates or loads some data that will be used throughout the life of the servlet. The init method definition looks like this: public void init() throws ServletException { // Initialization code... The service() Method The service() method is the main method to perform the actual task. The servlet container (i.e. web server) calls the service() method to handle requests coming from the client( browsers) and to write the formatted response back to the client. Each time the server receives a request for a servlet, the server spawns a new thread and calls service. The service() method checks the HTTP request type (GET, POST, PUT, DELETE, etc.) and calls doget, dopost, doput, dodelete, etc. methods as appropriate. 7

15 Here is the signature of this method: public void service(servletrequest request, ServletResponse response) throws ServletException, IOException{ The service () method is called by the container and service method invokes doge, dopost, doput, dodelete, etc. methods as appropriate. So you have nothing to do with service() method but you override either doget() or dopost() depending on what type of request you receive from the client. The doget() and dopost() are most frequently used methods with in each service request. Here is the signature of these two methods. The doget() Method A GET request results from a normal request for a URL or from an HTML form that has no METHOD specified and it should be handled by doget() method. public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Servlet code The dopost() Method A POST request results from an HTML form that specifically lists POST as the METHOD and it should be handled by dopost() method. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Servlet code The destroy() Method The destroy() method is called only once at the end of the life cycle of a servlet. This method gives your servlet a chance to close database connections, halt background threads, write cookie lists or hit counts to disk, and perform other such cleanup activities. After the destroy() method is called, the servlet object is marked for garbage collection. The destroy method definition looks like this: 8

16 public void destroy() { // Finalization code... Architecture Diagram The following figure depicts a typical servlet life-cycle scenario. First the HTTP requests coming to the server are delegated to the servlet container. The servlet container loads the servlet before invoking the service() method. Then the servlet container handles multiple requests by spawning multiple threads, each thread executing the service() method of a single instance of the servlet. 9

17 4. Servlets Examples Java Servlets Servlets are Java classes which service HTTP requests and implement the javax.servlet.servlet interface. Web application developers typically write servlets that extend javax.servlet.http.httpservlet, an abstract class that implements the Servlet interface and is specially designed to handle HTTP requests. Sample Code Following is the sample source code structure of a servlet example to show Hello World: // Import required java libraries import java.io.*; import javax.servlet.*; import javax.servlet.http.*; // Extend HttpServlet class public class HelloWorld extends HttpServlet { private String message; public void init() throws ServletException { // Do required initialization message = "Hello World"; public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); // Actual logic goes here. PrintWriter out = response.getwriter(); 10

18 out.println("<h1>" + message + "</h1>"); public void destroy() { // do nothing. Compiling a Servlet Let us create a file with name HelloWorld.java with the code shown above. Place this file at C:\ServletDevel (in Windows) or at /usr/servletdevel (in Unix). This path location must be added to CLASSPATH before proceeding further. Assuming your environment is setup properly, go in ServletDevel directory and compile HelloWorld.java as follows: $ javac HelloWorld.java If the servlet depends on any other libraries, you have to include those JAR files on your CLASSPATH as well. I have included only servlet-api.jar JAR file because I'm not using any other library in Hello World program. This command line uses the built-in javac compiler that comes with the Sun Microsystems Java Software Development Kit (JDK). For this command to work properly, you have to include the location of the Java SDK that you are using in the PATH environment variable. If everything goes fine, above compilation would produce HelloWorld.class file in the same directory. Next section would explain how a compiled servlet would be deployed in production. Servlet Deployment By default, a servlet application is located at the path <Tomcat-installationdirectory>/webapps/ROOT and the class file would reside in <Tomcat-installationdirectory>/webapps/ROOT/WEB-INF/classes. If you have a fully qualified class name of com.myorg.myservlet, then this servlet class must be located in WEB-INF/classes/com/myorg/MyServlet.class. For now, let us copy HelloWorld.class into <Tomcat-installationdirectory>/webapps/ROOT/WEB-INF/classes and create following entries in web.xml file located in <Tomcat-installation-directory>/webapps/ROOT/WEB-INF/ <servlet> <servlet-name>helloworld</servlet-name> 11

19 <servlet-class>helloworld</servlet-class> </servlet> <servlet-mapping> <servlet-name>helloworld</servlet-name> <url-pattern>/helloworld</url-pattern> </servlet-mapping> Above entries to be created inside <web-app>...</web-app> tags available in web.xml file. There could be various entries in this table already available, but never mind. You are almost done, now let us start tomcat server using <Tomcat-installationdirectory>\bin\startup.bat (on Windows) or <Tomcat-installationdirectory>/bin/startup.sh (on Linux/Solaris etc.) and finally type in the browser's address box. If everything goes fine, you would get the following result: 12

20 5. Servlets Form Data Java Servlets You must have come across many situations when you need to pass some information from your browser to web server and ultimately to your backend program. The browser uses two methods to pass this information to web server. These methods are GET Method and POST Method. GET Method The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the? (question mark) symbol as follows: The GET method is the default method to pass information from browser to web server and it produces a long string that appears in your browser's Location:box. Never use the GET method if you have password or other sensitive information to pass to the server. The GET method has size limitation: only 1024 characters can be used in a request string. This information is passed using QUERY_STRING header and will be accessible through QUERY_STRING environment variable and Servlet handles this type of requests using doget() method. POST Method A generally more reliable method of passing information to a backend program is the POST method. This packages the information in exactly the same way as GET method, but instead of sending it as a text string after a? (question mark) in the URL it sends it as a separate message. This message comes to the backend program in the form of the standard input which you can parse and use for your processing. Servlet handles this type of requests using dopost() method. Reading Form Data using Servlet Servlets handles form data parsing automatically using the following methods depending on the situation: getparameter(): You call request.getparameter() method to get the value of a form parameter. getparametervalues(): Call this method if the parameter appears more than once and returns multiple values, for example checkbox. getparameternames(): Call this method if you want a complete list of all parameters in the current request. 13

21 GET Method Example using URL Here is a simple URL which will pass two values to HelloForm program using GET method. Given below is the HelloForm.java servlet program to handle input given by web browser. We are going to use getparameter() method which makes it very easy to access passed information: // Import required java libraries import java.io.*; import javax.servlet.*; import javax.servlet.http.*; // Extend HttpServlet class public class HelloForm extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "Using GET Method to Read Form Data"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n" + "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" + " <li><b>first Name</b>: " + request.getparameter("first_name") + "\n" + " <li><b>last Name</b>: " 14

22 + request.getparameter("last_name") + "\n" + "</ul>\n" + "</body></html>"); Assuming your environment is set up properly, compile HelloForm.java as follows: $ javac HelloForm.java If everything goes fine, above compilation would produce HelloForm.class file. Next you would have to copy this class file in <Tomcat-installationdirectory>/webapps/ROOT/WEB-INF/classes and create following entries in web.xml file located in <Tomcat-installation-directory>/webapps/ROOT/WEB-INF/ <servlet> <servlet-name>helloform</servlet-name> <servlet-class>helloform</servlet-class> </servlet> <servlet-mapping> <servlet-name>helloform</servlet-name> <url-pattern>/helloform</url-pattern> </servlet-mapping> Now type in your browser's Location:box and make sure you already started tomcat server, before firing above command in the browser. This would generate following result: Using GET Method to Read Form Data First Name: ZARA Last Name: ALI 15

23 GET Method Example Using Form Here is a simple example which passes two values using HTML FORM and submit button. We are going to use same Servlet HelloForm to handle this imput. <html> <body> <form action="helloform" method="get"> First Name: <input type="text" name="first_name"> <br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="submit" /> </form> </body> </html> Keep this HTML in a file Hello.htm and put it in <Tomcat-installationdirectory>/webapps/ROOT directory. When you would access here is the actual output of the above form. First Name: Last Name: Submit Try to enter First Name and Last Name and then click submit button to see the result on your local machine where tomcat is running. Based on the input provided, it will generate similar result as mentioned in the above example. POST Method Example Using Form Let us do little modification in the above servlet, so that it can handle GET as well as POST methods. Below is HelloForm.java servlet program to handle input given by web browser using GET or POST methods. // Import required java libraries import java.io.*; import javax.servlet.*; import javax.servlet.http.*; // Extend HttpServlet class public class HelloForm extends HttpServlet { // Method to handle GET method request. 16

24 public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "Using GET Method to Read Form Data"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n" + "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" + " <li><b>first Name</b>: " + request.getparameter("first_name") + "\n" + " <li><b>last Name</b>: " + request.getparameter("last_name") + "\n" + "</ul>\n" + "</body></html>"); // Method to handle POST method request. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { doget(request, response); Now compile and deploy the above Servlet and test it using Hello.htm with the POST method as follows: 17

25 <html> <body> <form action="helloform" method="post"> First Name: <input type="text" name="first_name"> <br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="submit" /> </form> </body> </html> Here is the actual output of the above form, Try to enter First and Last Name and then click submit button to see the result on your local machine where tomcat is running. First Name: Last Name: Submit Based on the input provided, it would generate similar result as mentioned in the above examples. Passing Checkbox Data to Servlet Program Checkboxes are used when more than one option is required to be selected. Here is example HTML code, CheckBox.htm, for a form with two checkboxes <html> <body> <form action="checkbox" method="post" target="_blank"> <input type="checkbox" name="maths" checked="checked" /> Maths <input type="checkbox" name="physics" /> Physics <input type="checkbox" name="chemistry" checked="checked" /> Chemistry <input type="submit" value="select Subject" /> </form> </body> </html> The result of this code is the following form 18

26 Maths Physics Chemistry Select Subject Selected Subject Given below is the CheckBox.java servlet program to handle input given by web browser for checkbox button. // Import required java libraries import java.io.*; import javax.servlet.*; import javax.servlet.http.*; // Extend HttpServlet class public class CheckBox extends HttpServlet { // Method to handle GET method request. public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "Reading Checkbox Data"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n" + "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" + " <li><b>maths Flag : </b>: " + request.getparameter("maths") + "\n" + " <li><b>physics Flag: </b>: " + request.getparameter("physics") + "\n" + 19

27 " <li><b>chemistry Flag: </b>: " + request.getparameter("chemistry") + "\n" + "</ul>\n" + "</body></html>"); // Method to handle POST method request. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { doget(request, response); For the above example, it would display following result: Reading Checkbox Data Maths Flag : : on Physics Flag: : null Chemistry Flag: : on Reading All Form Parameters Following is the generic example which uses getparameternames() method of HttpServletRequest to read all the available form parameters. This method returns an Enumeration that contains the parameter names in an unspecified order. Once we have an Enumeration, we can loop down the Enumeration in standard way by, using hasmoreelements() method to determine when to stop and using nextelement() method to get each parameter name. // Import required java libraries import java.io.*; 20

28 import javax.servlet.*; import javax.servlet.http.*; import java.util.*; // Extend HttpServlet class public class ReadParams extends HttpServlet { // Method to handle GET method request. public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "Reading All Form Parameters"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n" + "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<table width=\"100%\" border=\"1\" align=\"center\">\n" + "<tr bgcolor=\"#949494\">\n" + "<th>param Name</th><th>Param Value(s)</th>\n"+ "</tr>\n"); Enumeration paramnames = request.getparameternames(); while(paramnames.hasmoreelements()) { String paramname = (String)paramNames.nextElement(); out.print("<tr><td>" + paramname + "</td>\n<td>"); String[] paramvalues = 21

29 request.getparametervalues(paramname); // Read single valued data if (paramvalues.length == 1) { String paramvalue = paramvalues[0]; if (paramvalue.length() == 0) out.println("<i>no Value</i>"); else out.println(paramvalue); else { // Read multiple valued data out.println("<ul>"); for(int i=0; i < paramvalues.length; i++) { out.println("<li>" + paramvalues[i]); out.println("</ul>"); out.println("</tr>\n</table>\n</body></html>"); // Method to handle POST method request. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { doget(request, response); Now, try the above servlet with the following form: <html> <body> <form action="readparams" method="post" target="_blank"> <input type="checkbox" name="maths" checked="checked" /> Maths <input type="checkbox" name="physics" /> Physics <input type="checkbox" name="chemistry" checked="checked" /> Chem <input type="submit" value="select Subject" /> </form> 22

30 </body> </html> Now calling servlet using the above form would generate the following result: Reading All Form Parameters Param maths chemistry Value(s) on on You can try the above servlet to read any other form's data having other objects like text box, radio button or drop down box etc. 23

31 6. Servlets Client HTTP Request Java Servlets When a browser requests for a web page, it sends lot of information to the web server which cannot be read directly because this information travel as a part of header of HTTP request. You can check HTTP Protocol for more information on this. Following is the important header information which comes from browser side and you would use very frequently in web programming: Header Description Accept This header specifies the MIME types that the browser or other clients can handle. Values of image/png or image/jpeg are the two most common possibilities. Accept-Charset This header specifies the character sets the browser can use to display the information. For example ISO Accept-Encoding Accept-Language Authorization Connection Content-Length Cookie Host If-Modified-Since This header specifies the types of encodings that the browser knows how to handle. Values of gzip or compress are the two most common possibilities. This header specifies the client's preferred languages in case the servlet can produce results in more than one language. For example en, en-us, ru, etc. This header is used by clients to identify themselves when accessing password-protected Web pages. This header indicates whether the client can handle persistent HTTP connections. Persistent connections permit the client or other browser to retrieve multiple files with a single request. A value of Keep-Alive means that persistent connections should be used This header is applicable only to POST requests and gives the size of the POST data in bytes. This header returns cookies to servers that previously sent them to the browser. This header specifies the host and port as given in the original URL. This header indicates that the client wants the page only if it has been changed after the specified date. The server sends a code, 304 which means Not Modified header if no newer result is available. 24

32 If-Unmodified-Since This header is the reverse of If-Modified-Since; it specifies that the operation should succeed only if the document is older than the specified date. Referrer This header indicates the URL of the referring Web page. For example, if you are at Web page 1 and click on a link to Web page 2, the URL of Web page 1 is included in the Referrer header when the browser requests Web page 2. User-Agent This header identifies the browser or other client making the request and can be used to return different content to different types of browsers. Methods to read HTTP Header There are following methods which can be used to read HTTP header in your servlet program. These methods are available with HttpServletRequest object. S.N. Method & Description 1 Cookie[] getcookies() Returns an array containing all of the Cookie objects the client sent with this request. 2 Enumeration getattributenames() Returns an Enumeration containing the names of the attributes available to this request. 3 Enumeration getheadernames() Returns an enumeration of all the header names this request contains. 4 Enumeration getparameternames() Returns an Enumeration of String objects containing the names of the parameters contained in this request. 5 HttpSession getsession() Returns the current session associated with this request, or if the request does not have a session, creates one. 6 HttpSession getsession(boolean create) Returns the current HttpSession associated with this request or, if if there is no current session and value of create is true, returns a new session. 7 Locale getlocale() Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. 25

33 8 Object getattribute(string name) Returns the value of the named attribute as an Object, or null if no attribute of the given name exists. 9 ServletInputStream getinputstream() Retrieves the body of the request as binary data using a ServletInputStream. 10 String getauthtype() Returns the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the JSP was not protected. 11 String getcharacterencoding() Returns the name of the character encoding used in the body of this request. 12 String getcontenttype() Returns the MIME type of the body of the request, or null if the type is not known. 13 String getcontextpath() Returns the portion of the request URI that indicates the context of the request. 14 String getheader(string name) Returns the value of the specified request header as a String. 15 String getmethod() Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. 16 String getparameter(string name) Returns the value of a request parameter as a String, or null if the parameter does not exist String getpathinfo() Returns any extra path information associated with the URL the client sent when it made this request. String getprotocol() Returns the name and version of the protocol the request. 19 String getquerystring() Returns the query string that is contained in the request URL after the path. 26

34 20 String getremoteaddr() Returns the Internet Protocol (IP) address of the client that sent the request String getremotehost() Returns the fully qualified name of the client that sent the request. String getremoteuser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated String getrequesturi() Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. String getrequestedsessionid() Returns the session ID specified by the client. String getservletpath() Returns the part of this request's URL that calls the JSP. String[] getparametervalues(string name) Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist. 27 boolean issecure() Returns a Boolean indicating whether this request was made using a secure channel, such as HTTPS. 28 int getcontentlength() Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known int getintheader(string name) Returns the value of the specified request header as an int. int getserverport() Returns the port number on which this request was received. HTTP Header Request Example Following is the example which uses getheadernames() method of HttpServletRequest to read the HTTP header information. This method returns an Enumeration that contains the header information associated with the current HTTP request. Once we have an Enumeration, we can loop down the Enumeration in the standard manner, using hasmoreelements() method to determine when to stop and using nextelement() method to get each parameter name. // Import required java libraries 27

35 import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; // Extend HttpServlet class public class DisplayHeader extends HttpServlet { // Method to handle GET method request. public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String title = "HTTP Header Request Example"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n"+ "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<table width=\"100%\" border=\"1\" align=\"center\">\n" + "<tr bgcolor=\"#949494\">\n" + "<th>header Name</th><th>Header Value(s)</th>\n"+ "</tr>\n"); Enumeration headernames = request.getheadernames(); while(headernames.hasmoreelements()) { String paramname = (String)headerNames.nextElement(); out.print("<tr><td>" + paramname + "</td>\n"); 28

36 String paramvalue = request.getheader(paramname); out.println("<td> " + paramvalue + "</td></tr>\n"); out.println("</table>\n</body></html>"); // Method to handle POST method request. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { doget(request, response); Now calling the above servlet would generate the following result: HTTP Header Request Example Header Name Header Value(s) accept */* accept-language user-agent accept-encoding host connection cache-control en-us Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.2; MS-RTC LM 8) gzip, deflate localhost:8080 Keep-Alive no-cache 29

37 7. Servlets Server HTTP Response Java Servlets As discussed in the previous chapter, when a Web server responds to an HTTP request, the response typically consists of a status line, some response headers, a blank line, and the document. A typical response looks like this: HTTP/ OK Content-Type: text/html Header2: HeaderN:... (Blank Line) <!doctype...> <html> <head>...</head> <body>... </body> </html> The status line consists of the HTTP version (HTTP/1.1 in the example), a status code (200 in the example), and a very short message corresponding to the status code (OK in the example). Following is a summary of the most useful HTTP 1.1 response headers which go back to the browser from web server side and you would use them very frequently in web programming: Header Description Allow This header specifies the request methods (GET, POST, etc.) that the server supports. Cache-Control This header specifies the circumstances in which the response document can safely be cached. It can have values public, private or no-cache etc. Public means document is cacheable, Private means document is for a single user and can only be stored in private (non-shared) caches and nocache means document should never be cached. 30

38 Connection This header instructs the browser whether to use persistent in HTTP connections or not. A value of close instructs the browser not to use persistent HTTP connections and keepalive means using persistent connections. Content-Disposition This header lets you request that the browser ask the user to save the response to disk in a file of the given name. Content-Encoding Content-Language This header specifies the way in which the page was encoded during transmission. This header signifies the language in which the document is written. For example en, en-us, ru, etc. Content-Length This header indicates the number of bytes in the response. This information is needed only if the browser is using a persistent (keep-alive) HTTP connection. Content-Type This header gives the MIME (Multipurpose Internet Mail Extension) type of the response document. Expires This header specifies the time at which the content should be considered out-of-date and thus no longer be cached. Last-Modified This header indicates when the document was last changed. The client can then cache the document and supply a date by an If-Modified-Since request header in later requests. Location This header should be included with all responses that have a status code in the 300s. This notifies the browser of the document address. The browser automatically reconnects to this location and retrieves the new document. Refresh Retry-After This header specifies how soon the browser should ask for an updated page. You can specify time in number of seconds after which a page would be refreshed. This header can be used in conjunction with a 503 (Service Unavailable) response to tell the client how soon it can repeat its request. Set-Cookie This header specifies a cookie associated with the page. 31

39 Methods to Set HTTP Response Header There are following methods which can be used to set HTTP response header in your servlet program. These methods are available with HttpServletResponse object. S.N Method & Description String encoderedirecturl(string url) Encodes the specified URL for use in the sendredirect method or, if encoding is not needed, returns the URL unchanged. String encodeurl(string url) Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. boolean containsheader(string name) Returns a Boolean indicating whether the named response header has already been set. boolean iscommitted() Returns a Boolean indicating if the response has been committed. 5 void addcookie(cookie cookie) Adds the specified cookie to the response. 6 void adddateheader(string name, long date) Adds a response header with the given name and date-value. 7 void addheader(string name, String value) Adds a response header with the given name and value. 8 void addintheader(string name, int value) Adds a response header with the given name and integer value. 9 void flushbuffer() Forces any content in the buffer to be written to the client. 10 void reset() Clears any data that exists in the buffer as well as the status code and headers void resetbuffer() Clears the content of the underlying buffer in the response without clearing headers or status code. void senderror(int sc) Sends an error response to the client using the specified status code and clearing the buffer. 13 void senderror(int sc, String msg) Sends an error response to the client using the specified status. void sendredirect(string location) 14 Sends a temporary redirect response to the client using the specified redirect location URL. 15 void setbuffersize(int size) Sets the preferred buffer size for the body of the response. 16 void setcharacterencoding(string charset) 32

40 Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. void setcontentlength(int len) Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header. void setcontenttype(string type) Sets the content type of the response being sent to the client, if the response has not been committed yet. void setdateheader(string name, long date) Sets a response header with the given name and date-value. void setheader(string name, String value) Sets a response header with the given name and value. void setintheader(string name, int value) Sets a response header with the given name and integer value. void setlocale(locale loc) Sets the locale of the response, if the response has not been committed yet. void setstatus(int sc) Sets the status code for this response. HTTP Header Response Example You already have seen setcontenttype() method working in previous examples and following example would also use same method, additionally we would use setintheader() method to set Refresh header. // Import required java libraries import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; // Extend HttpServlet class public class Refresh extends HttpServlet { // Method to handle GET method request. public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { // Set refresh, autoload time as 5 seconds response.setintheader("refresh", 5); // Set response content type response.setcontenttype("text/html"); 33

41 // Get current time Calendar calendar = new GregorianCalendar(); String am_pm; int hour = calendar.get(calendar.hour); int minute = calendar.get(calendar.minute); int second = calendar.get(calendar.second); if(calendar.get(calendar.am_pm) == 0) am_pm = "AM"; else am_pm = "PM"; String CT = hour+":"+ minute +":"+ second +" "+ am_pm; PrintWriter out = response.getwriter(); String title = "Auto Refresh Header Setting"; String doctype = "<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n"; out.println(doctype + "<html>\n" + "<head><title>" + title + "</title></head>\n"+ "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<p>current Time is: " + CT + "</p>\n"); // Method to handle POST method request. public void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { doget(request, response); 34

42 Now calling the above servlet would display current system time after every 5 seconds as follows. Just run the servlet and wait to see the result: Auto Refresh Header Setting Current Time is: 9:44:50 PM 35

43 8. Servlets Http Status Codes Java Servlets The format of the HTTP request and HTTP response messages are similar and will have following structure: An initial status line + CRLF ( Carriage Return + Line Feed i.e. New Line ) Zero or more header lines + CRLF A blank line, i.e., a CRLF An optional message body like file, query data or query output. For example, a server response header looks as follows: HTTP/ OK Content-Type: text/html Header2: HeaderN:... (Blank Line) <!doctype...> <html> <head>...</head> <body>... </body> </html> The status line consists of the HTTP version (HTTP/1.1 in the example), a status code (200 in the example), and a very short message corresponding to the status code (OK in the example). Following is a list of HTTP status codes and associated messages that might be returned from the Web Server: Code Message Description 100 Continue Only a part of the request has been received by the server, but as long as it has not been rejected, the client should continue with the request 101 Switching Protocols The server switches protocol. 36

44 200 OK The request is OK 201 Created 202 Accepted The request is complete, and a new resource is created The request is accepted for processing, but the processing is not complete. 203 Non-authoritative Information 204 No Content 205 Reset Content 206 Partial Content 300 Multiple Choices A link list. The user can select a link and go to that location. Maximum five addresses 301 Moved Permanently The requested page has moved to a new url 302 Found 303 See Other The requested page has moved temporarily to a new url The requested page can be found under a different url 304 Not Modified 305 Use Proxy 306 Unused This code was used in a previous version. It is no longer used, but the code is reserved. 307 Temporary Redirect The requested page has moved temporarily to a new url. 400 Bad Request The server did not understand the request 401 Unauthorized The requested page needs a username and a password 402 Payment Required You cannot use this code yet 403 Forbidden Access is forbidden to the requested page 404 Not Found The server cannot find the requested page. 405 Method Not Allowed The method specified in the request is not allowed. 37

SERVLETSTUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com

SERVLETSTUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com Servlets Tutorial SERVLETSTUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Servlets Tutorial Servlets provide a component-based, platform-independent method for building Web-based

More information

Creating Java EE Applications and Servlets with IntelliJ IDEA

Creating Java EE Applications and Servlets with IntelliJ IDEA Creating Java EE Applications and Servlets with IntelliJ IDEA In this tutorial you will: 1. Create IntelliJ IDEA project for Java EE application 2. Create Servlet 3. Deploy the application to JBoss server

More information

Handling the Client Request: Form Data

Handling the Client Request: Form Data 2012 Marty Hall Handling the Client Request: Form Data Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html 3 Customized Java EE Training: http://courses.coreservlets.com/

More information

An introduction to web programming with Java

An introduction to web programming with Java Chapter 1 An introduction to web programming with Java Objectives Knowledge Objectives (continued) The first page of a shopping cart application The second page of a shopping cart application Components

More information

Web Container Components Servlet JSP Tag Libraries

Web Container Components Servlet JSP Tag Libraries Web Application Development, Best Practices by Jeff Zhuk, JavaSchool.com ITS, Inc. dean@javaschool.com Web Container Components Servlet JSP Tag Libraries Servlet Standard Java class to handle an HTTP request

More information

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun 1 What is a Servlet? A Servlet is a Java program that extends the capabilities of servers. Inherently multi-threaded.

More information

10. Java Servelet. Introduction

10. Java Servelet. Introduction Chapter 10 Java Servlets 227 10. Java Servelet Introduction Java TM Servlet provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing

More information

ACM Crossroads Student Magazine The ACM's First Electronic Publication

ACM Crossroads Student Magazine The ACM's First Electronic Publication Page 1 of 8 ACM Crossroads Student Magazine The ACM's First Electronic Publication Crossroads Home Join the ACM! Search Crossroads crossroads@acm.org ACM / Crossroads / Columns / Connector / An Introduction

More information

Web Programming: Announcements. Sara Sprenkle August 3, 2006. August 3, 2006. Assignment 6 due today Project 2 due next Wednesday Review XML

Web Programming: Announcements. Sara Sprenkle August 3, 2006. August 3, 2006. Assignment 6 due today Project 2 due next Wednesday Review XML Web Programming: Java Servlets and JSPs Sara Sprenkle Announcements Assignment 6 due today Project 2 due next Wednesday Review XML Sara Sprenkle - CISC370 2 1 Web Programming Client Network Server Web

More information

2. Follow the installation directions and install the server on ccc

2. Follow the installation directions and install the server on ccc 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 information

reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002)

reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002) 1 cse879-03 2010-03-29 17:23 Kyung-Goo Doh Chapter 3. Web Application Technologies reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002) 1. The HTTP Protocol. HTTP = HyperText

More information

Java Servlet Tutorial. Java Servlet Tutorial

Java Servlet Tutorial. Java Servlet Tutorial Java Servlet Tutorial i Java Servlet Tutorial Java Servlet Tutorial ii Contents 1 Introduction 1 1.1 Servlet Process.................................................... 1 1.2 Merits.........................................................

More information

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview Web and HTTP Protocolo HTTP Web page consists of objects Object can be HTML file, JPEG image, Java applet, audio file, Web page consists of base HTML-file which includes several referenced objects Each

More information

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java Java EE Introduction, Content Component Architecture: Why and How Java EE: Enterprise Java The Three-Tier Model The three -tier architecture allows to maintain state information, to improve performance,

More information

Introduction to J2EE Web Technologies

Introduction to J2EE Web Technologies Introduction to J2EE Web Technologies Kyle Brown Senior Technical Staff Member IBM WebSphere Services RTP, NC brownkyl@us.ibm.com Overview What is J2EE? What are Servlets? What are JSP's? How do you use

More information

Development of Web Applications

Development of Web Applications Development of Web Applications Principles and Practice Vincent Simonet, 2013-2014 Université Pierre et Marie Curie, Master Informatique, Spécialité STL 3 Server Technologies Vincent Simonet, 2013-2014

More information

Introduction to Web Technologies

Introduction to Web Technologies Secure Web Development Teaching Modules 1 Introduction to Web Technologies Contents 1 Concepts... 1 1.1 Web Architecture... 2 1.2 Uniform Resource Locators (URL)... 3 1.3 HTML Basics... 4 1.4 HTTP Protocol...

More information

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang Supplement IV.E: Tutorial for Tomcat For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Obtaining and Installing Tomcat Starting and Stopping Tomcat Choosing

More information

INTRODUCTION TO WEB TECHNOLOGY

INTRODUCTION TO WEB TECHNOLOGY UNIT-I Introduction to Web Technologies: Introduction to web servers like Apache1.1, IIS, XAMPP (Bundle Server), WAMP Server(Bundle Server), handling HTTP Request and Response, installation of above servers

More information

2.8. Session management

2.8. Session management 2.8. Session management Juan M. Gimeno, Josep M. Ribó January, 2008 Session management. Contents Motivation Hidden fields URL rewriting Cookies Session management with the Servlet/JSP API Examples Scopes

More information

Chapter 27 Hypertext Transfer Protocol

Chapter 27 Hypertext Transfer Protocol Chapter 27 Hypertext Transfer Protocol Columbus, OH 43210 Jain@CIS.Ohio-State.Edu http://www.cis.ohio-state.edu/~jain/ 27-1 Overview Hypertext language and protocol HTTP messages Browser architecture CGI

More information

Principles and Techniques of DBMS 5 Servlet

Principles and Techniques of DBMS 5 Servlet Principles and Techniques of DBMS 5 Servlet Haopeng Chen REliable, INtelligentand Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp e- mail:

More information

1. When will an IP process drop a datagram? 2. When will an IP process fragment a datagram? 3. When will a TCP process drop a segment?

1. When will an IP process drop a datagram? 2. When will an IP process fragment a datagram? 3. When will a TCP process drop a segment? Questions 1. When will an IP process drop a datagram? 2. When will an IP process fragment a datagram? 3. When will a TCP process drop a segment? 4. When will a TCP process resend a segment? CP476 Internet

More information

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6 The Proxy Server THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6 2 1 Purpose The proxy server acts as an intermediate server that relays requests between

More information

The Hyper-Text Transfer Protocol (HTTP)

The Hyper-Text Transfer Protocol (HTTP) The Hyper-Text Transfer Protocol (HTTP) Antonio Carzaniga Faculty of Informatics University of Lugano October 4, 2011 2005 2007 Antonio Carzaniga 1 HTTP message formats Outline HTTP methods Status codes

More information

HTTP Protocol. Bartosz Walter <Bartek.Walter@man.poznan.pl>

HTTP Protocol. Bartosz Walter <Bartek.Walter@man.poznan.pl> HTTP Protocol Bartosz Walter Agenda Basics Methods Headers Response Codes Cookies Authentication Advanced Features of HTTP 1.1 Internationalization HTTP Basics defined in

More information

11.1 Web Server Operation

11.1 Web Server Operation 11.1 Web Server Operation - Client-server systems - When two computers are connected, either could be the client - The client initiates the communication, which the server accepts - Generally, clients

More information

Building Java Servlets with Oracle JDeveloper

Building Java Servlets with Oracle JDeveloper Building Java Servlets with Oracle JDeveloper Chris Schalk Oracle Corporation Introduction Developers today face a formidable task. They need to create large, distributed business applications. The actual

More information

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling

More information

Controlling Web Application Behavior

Controlling Web Application Behavior 2006 Marty Hall Controlling Web Application Behavior The Deployment Descriptor: web.xml JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

HTTP. Internet Engineering. Fall 2015. Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

HTTP. Internet Engineering. Fall 2015. Bahador Bakhshi CE & IT Department, Amirkabir University of Technology HTTP Internet Engineering Fall 2015 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology Questions Q1) How do web server and client browser talk to each other? Q1.1) What is the common

More information

Web Applications. For live Java training, please see training courses at

Web Applications. For live Java training, please see training courses at 2009 Marty Hall Using and Deploying Web Applications Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

By Bardia, Patit, and Rozheh

By Bardia, Patit, and Rozheh HTTP By Bardia, Patit, and Rozheh HTTP - Introduction - Hyper Text Transfer Protocol -uses the TCP/IP technology -has had the most impact on the World Wide Web (WWW) - specs in RFC 2616 (RFC2616) HTTP

More information

GET /FB/index.html HTTP/1.1 Host: lmi32.cnam.fr

GET /FB/index.html HTTP/1.1 Host: lmi32.cnam.fr GET /FB/index.html HTTP/1.1 Host: lmi32.cnam.fr HTTP/1.1 200 OK Date: Thu, 20 Oct 2005 14:42:54 GMT Server: Apache/2.0.50 (Linux/SUSE) Last-Modified: Thu, 20 Oct 2005 14:41:56 GMT ETag: "2d7b4-14b-8efd9500"

More information

Java Server Pages combined with servlets in action. Generals. Java Servlets

Java Server Pages combined with servlets in action. Generals. Java Servlets Java Server Pages combined with servlets in action We want to create a small web application (library), that illustrates the usage of JavaServer Pages combined with Java Servlets. We use the JavaServer

More information

CHAPTER 9: SERVLET AND JSP FILTERS

CHAPTER 9: SERVLET AND JSP FILTERS 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 information

Network Technologies

Network Technologies Network Technologies Glenn Strong Department of Computer Science School of Computer Science and Statistics Trinity College, Dublin January 28, 2014 What Happens When Browser Contacts Server I Top view:

More information

PA165 - Lab session - Web Presentation Layer

PA165 - Lab session - Web Presentation Layer PA165 - Lab session - Web Presentation Layer Author: Martin Kuba Goal Experiment with basic building blocks of Java server side web technology servlets, filters, context listeners,

More information

15-415 Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

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

More information

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/ 2012 Marty Hall Session Tracking Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html 2 Customized Java EE Training: http://courses.coreservlets.com/

More information

Ch-03 Web Applications

Ch-03 Web Applications Ch-03 Web Applications 1. What is ServletContext? a. ServletContext is an interface that defines a set of methods that helps us to communicate with the servlet container. There is one context per "web

More information

Internet Technologies Internet Protocols and Services

Internet Technologies Internet Protocols and Services QAFQAZ UNIVERSITY Computer Engineering Department Internet Technologies Internet Protocols and Services Dr. Abzetdin ADAMOV Chair of Computer Engineering Department aadamov@qu.edu.az http://ce.qu.edu.az/~aadamov

More information

CS640: Introduction to Computer Networks. Applications FTP: The File Transfer Protocol

CS640: Introduction to Computer Networks. Applications FTP: The File Transfer Protocol CS640: Introduction to Computer Networks Aditya Akella Lecture 4 - Application Protocols, Performance Applications FTP: The File Transfer Protocol user at host FTP FTP user client interface local file

More information

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post Understanding Architecture and Framework of J2EE using Web Application Devadrita Dey Sarkar,Anavi jaiswal, Ankur Saxena Amity University,UTTAR PRADESH Sector-125, Noida, UP-201303, India Abstract: This

More information

Usability. Usability

Usability. Usability Objectives Review Usability Web Application Characteristics Review Servlets Deployment Sessions, Cookies Usability Trunk Test Harder than you probably thought Your answers didn t always agree Important

More information

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

SSC - Web applications and development Introduction and Java Servlet (II) SSC - Web applications and development Introduction and Java Servlet (II) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics Servlet Configuration

More information

Clojure Web Development

Clojure Web Development Clojure Web Development Philipp Schirmacher Stefan Tilkov innoq We'll take care of it. Personally. http://www.innoq.com 2011 innoq Deutschland GmbH http://upload.wikimedia.org/wikip 2011 innoq Deutschland

More information

Building a Multi-Threaded Web Server

Building a Multi-Threaded Web Server Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous

More information

COMP9321 Web Applications Engineering: Java Servlets

COMP9321 Web Applications Engineering: Java Servlets COMP9321 Web Applications Engineering: Java s Service Oriented Computing Group, CSE, UNSW Week 2 H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 1 / 1 Different Layers in an Application Different solutions for

More information

Managing Data on the World Wide-Web

Managing Data on the World Wide-Web Managing Data on the World Wide-Web Sessions, Listeners, Filters, Shopping Cart Elad Kravi 1 Web Applications In the Java EE platform, web components provide the dynamic extension capabilities for a web

More information

Installing Java. Table of contents

Installing Java. Table of contents Table of contents 1 Jargon...3 2 Introduction...4 3 How to install the JDK...4 3.1 Microsoft Windows 95... 4 3.1.1 Installing the JDK... 4 3.1.2 Setting the Path Variable...5 3.2 Microsoft Windows 98...

More information

CONTROLLING WEB APPLICATION BEHAVIOR WITH

CONTROLLING WEB APPLICATION BEHAVIOR WITH CONTROLLING WEB APPLICATION BEHAVIOR WITH WEB.XML Chapter Topics in This Chapter Customizing URLs Turning off default URLs Initializing servlets and JSP pages Preloading servlets and JSP pages Declaring

More information

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics Lecture 9: Java Servlet and JSP Wendy Liu CSC309F Fall 2007 Outline HTTP Servlet Basics Servlet Lifecycle Request and Response Session Management JavaServer Pages (JSP) 1 2 HTTP Servlet Basics Current

More information

Application Security

Application Security 2009 Marty Hall Declarative Web Application Security Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

Announcements. Comments on project proposals will go out by email in next couple of days...

Announcements. Comments on project proposals will go out by email in next couple of days... Announcements Comments on project proposals will go out by email in next couple of days... 3-Tier Using TP Monitor client application TP monitor interface (API, presentation, authentication) transaction

More information

The HTTP Plug-in. Table of contents

The HTTP Plug-in. Table of contents Table of contents 1 What's it for?... 2 2 Controlling the HTTPPlugin... 2 2.1 Levels of Control... 2 2.2 Importing the HTTPPluginControl...3 2.3 Setting HTTPClient Authorization Module... 3 2.4 Setting

More information

Penetration from application down to OS

Penetration from application down to OS April 8, 2009 Penetration from application down to OS Getting OS access using IBM Websphere Application Server vulnerabilities Digitаl Security Research Group (DSecRG) Stanislav Svistunovich research@dsecrg.com

More information

LabVIEW Internet Toolkit User Guide

LabVIEW Internet Toolkit User Guide LabVIEW Internet Toolkit User Guide Version 6.0 Contents The LabVIEW Internet Toolkit provides you with the ability to incorporate Internet capabilities into VIs. You can use LabVIEW to work with XML documents,

More information

A Java proxy for MS SQL Server Reporting Services

A Java proxy for MS SQL Server Reporting Services 1 of 5 1/10/2005 9:37 PM Advertisement: Support JavaWorld, click here! January 2005 HOME FEATURED TUTORIALS COLUMNS NEWS & REVIEWS FORUM JW RESOURCES ABOUT JW A Java proxy for MS SQL Server Reporting Services

More information

Servlet and JSP Filters

Servlet and JSP Filters 2009 Marty Hall Servlet and JSP Filters Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

CloudOYE CDN USER MANUAL

CloudOYE CDN USER MANUAL CloudOYE CDN USER MANUAL Password - Based Access Logon to http://mycloud.cloudoye.com. Enter your Username & Password In case, you have forgotten your password, click Forgot your password to request a

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 Java Servlets I have presented a Java servlet example before to give you a sense of what a servlet looks like. From the example,

More information

Project #2. CSE 123b Communications Software. HTTP Messages. HTTP Basics. HTTP Request. HTTP Request. Spring 2002. Four parts

Project #2. CSE 123b Communications Software. HTTP Messages. HTTP Basics. HTTP Request. HTTP Request. Spring 2002. Four parts CSE 123b Communications Software Spring 2002 Lecture 11: HTTP Stefan Savage Project #2 On the Web page in the next 2 hours Due in two weeks Project reliable transport protocol on top of routing protocol

More information

In this chapter the concept of Servlets, not the entire Servlet specification, is

In this chapter the concept of Servlets, not the entire Servlet specification, is falkner.ch2.qxd 8/21/03 4:57 PM Page 31 Chapter 2 Java Servlets In this chapter the concept of Servlets, not the entire Servlet specification, is explained; consider this an introduction to the Servlet

More information

No. Time Source Destination Protocol Info 1190 131.859385 128.238.245.34 128.119.245.12 HTTP GET /ethereal-labs/http-ethereal-file1.html HTTP/1.

No. Time Source Destination Protocol Info 1190 131.859385 128.238.245.34 128.119.245.12 HTTP GET /ethereal-labs/http-ethereal-file1.html HTTP/1. Ethereal Lab: HTTP 1. The Basic HTTP GET/response interaction 1190 131.859385 128.238.245.34 128.119.245.12 HTTP GET /ethereal-labs/http-ethereal-file1.html HTTP/1.1 GET /ethereal-labs/http-ethereal-file1.html

More information

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat Pure server-side Web Applications with Java, JSP Discussion of networklevel http requests and responses Using the Java programming language (Java servlets and JSPs) Key lesson: The role of application

More information

An Overview of Java. overview-1

An Overview of Java. overview-1 An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2

More information

Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1

Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1 1 of 11 16.10.2002 11:41 Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1 Table of Contents Creating the directory structure Creating the Java code Compiling the code Creating the

More information

AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY

AN 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 information

An Overview of Servlet & JSP Technology

An Overview of Servlet & JSP Technology 2007 Marty Hall An Overview of Servlet & JSP Technology 2 Customized J2EE Training: http://courses.coreservlets.com/ Servlets, JSP, Struts, JSF, EJB3, Ajax, Java 5, Java 6, etc. Ruby/Rails coming soon.

More information

In this chapter, we lay the foundation for all our further discussions. We start

In this chapter, we lay the foundation for all our further discussions. We start 01 Struts.qxd 7/30/02 10:23 PM Page 1 CHAPTER 1 Introducing the Jakarta Struts Project and Its Supporting Components In this chapter, we lay the foundation for all our further discussions. We start by

More information

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture #3 2008 3 Apache.

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture #3 2008 3 Apache. JSP, and JSP, and JSP, and 1 2 Lecture #3 2008 3 JSP, and JSP, and Markup & presentation (HTML, XHTML, CSS etc) Data storage & access (JDBC, XML etc) Network & application protocols (, etc) Programming

More information

Application Servers - BEA WebLogic. Installing the Application Server

Application Servers - BEA WebLogic. Installing the Application Server Proven Practice Application Servers - BEA WebLogic. Installing the Application Server Product(s): IBM Cognos 8.4, BEA WebLogic Server Area of Interest: Infrastructure DOC ID: AS01 Version 8.4.0.0 Application

More information

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011 Servlet 3.0 Alexis Moussine-Pouchkine 1 Overview Java Servlet 3.0 API JSR 315 20 members Good mix of representation from major Java EE vendors, web container developers and web framework authors 2 Overview

More information

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server:

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server: The Web: some jargon Web page: consists of objects addressed by a URL Most Web pages consist of: base HTML page, and several referenced objects. URL has two components: host name and path name: User agent

More information

CSC 551: Web Programming. Spring 2004

CSC 551: Web Programming. Spring 2004 CSC 551: Web Programming Spring 2004 Java Overview Design goals & features platform independence, portable, secure, simple, object-oriented, Programming models applications vs. applets vs. servlets intro

More information

www.novell.com/documentation Policy Guide Access Manager 3.1 SP5 January 2013

www.novell.com/documentation Policy Guide Access Manager 3.1 SP5 January 2013 www.novell.com/documentation Policy Guide Access Manager 3.1 SP5 January 2013 Legal Notices Novell, Inc., makes no representations or warranties with respect to the contents or use of this documentation,

More information

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents 1 About this document... 2 2 Introduction... 2 3 Defining the data model... 2 4 Populating the database tables with

More information

ServletExec TM 6.0 Installation Guide. for Microsoft Internet Information Server SunONE Web Server Sun Java System Web Server and Apache HTTP Server

ServletExec TM 6.0 Installation Guide. for Microsoft Internet Information Server SunONE Web Server Sun Java System Web Server and Apache HTTP Server ServletExec TM 6.0 Installation Guide for Microsoft Internet Information Server SunONE Web Server Sun Java System Web Server and Apache HTTP Server ServletExec TM NEW ATLANTA COMMUNICATIONS, LLC 6.0 Installation

More information

CTIS 256 Web Technologies II. Week # 1 Serkan GENÇ

CTIS 256 Web Technologies II. Week # 1 Serkan GENÇ CTIS 256 Web Technologies II Week # 1 Serkan GENÇ Introduction Aim: to be able to develop web-based applications using PHP (programming language) and mysql(dbms). Internet is a huge network structure connecting

More information

www.novell.com/documentation Jobs Guide Identity Manager 4.0.1 February 10, 2012

www.novell.com/documentation Jobs Guide Identity Manager 4.0.1 February 10, 2012 www.novell.com/documentation Jobs Guide Identity Manager 4.0.1 February 10, 2012 Legal Notices Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation,

More information

Install guide for Websphere 7.0

Install guide for Websphere 7.0 DOCUMENTATION Install guide for Websphere 7.0 Jahia EE v6.6.1.0 Jahia s next-generation, open source CMS stems from a widely acknowledged vision of enterprise application convergence web, document, search,

More information

Setup Guide Access Manager 3.2 SP3

Setup Guide Access Manager 3.2 SP3 Setup Guide Access Manager 3.2 SP3 August 2014 www.netiq.com/documentation Legal Notice THIS DOCUMENT AND THE SOFTWARE DESCRIBED IN THIS DOCUMENT ARE FURNISHED UNDER AND ARE SUBJECT TO THE TERMS OF A LICENSE

More information

Java and Web. WebWork

Java and Web. WebWork Java and Web WebWork Client/Server server client request HTTP response Inside the Server (1) HTTP requests Functionality for communicating with clients using HTTP CSS Stat. page Dyn. page Dyn. page Our

More information

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007 WWW World Wide Web Aka The Internet dr. C. P. J. Koymans Informatics Institute Universiteit van Amsterdam November 30, 2007 dr. C. P. J. Koymans (UvA) WWW November 30, 2007 1 / 36 WWW history (1) 1968

More information

Web Application Programmer's Guide

Web Application Programmer's Guide Web Application Programmer's Guide JOnAS Team ( Florent BENOIT) - March 2009 - Copyright OW2 consortium 2008-2009 This work is licensed under the Creative Commons Attribution-ShareAlike License. To view

More information

INSIDE SERVLETS. Server-Side Programming for the Java Platform. An Imprint of Addison Wesley Longman, Inc.

INSIDE SERVLETS. Server-Side Programming for the Java Platform. An Imprint of Addison Wesley Longman, Inc. INSIDE SERVLETS Server-Side Programming for the Java Platform Dustin R. Callaway TT ADDISON-WESLEY An Imprint of Addison Wesley Longman, Inc. Reading, Massachusetts Harlow, England Menlo Park, California

More information

Please send your comments to: KZrobok@Setfocus.com

Please send your comments to: KZrobok@Setfocus.com Sun Certified Web Component Developer Study Guide - v2 Sun Certified Web Component Developer Study Guide...1 Authors Note...2 Servlets...3 The Servlet Model...3 The Structure and Deployment of Modern Servlet

More information

Virtual Open-Source Labs for Web Security Education

Virtual Open-Source Labs for Web Security Education , October 20-22, 2010, San Francisco, USA Virtual Open-Source Labs for Web Security Education Lixin Tao, Li-Chiou Chen, and Chienting Lin Abstract Web security education depends heavily on hands-on labs

More information

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,... 7 Web Databases Access to Web Databases: Servlets, Applets Java Server Pages PHP, PEAR Languages: Java, PHP, Python,... Prof. Dr. Dietmar Seipel 837 7.1 Access to Web Databases by Servlets Java Servlets

More information

Content Filtering Client Policy & Reporting Administrator s Guide

Content Filtering Client Policy & Reporting Administrator s Guide Content Filtering Client Policy & Reporting Administrator s Guide Notes, Cautions, and Warnings NOTE: A NOTE indicates important information that helps you make better use of your system. CAUTION: A CAUTION

More information

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1 BAPI Business Application Programming Interface Compiled by Y R Nagesh 1 What is BAPI A Business Application Programming Interface is a precisely defined interface providing access process and data in

More information

Crawl Proxy Installation and Configuration Guide

Crawl Proxy Installation and Configuration Guide Crawl Proxy Installation and Configuration Guide Google Enterprise EMEA Google Search Appliance is able to natively crawl secure content coming from multiple sources using for instance the following main

More information

Configuring Single Sign-on for WebVPN

Configuring Single Sign-on for WebVPN CHAPTER 8 This chapter presents example procedures for configuring SSO for WebVPN users. It includes the following sections: Using Single Sign-on with WebVPN, page 8-1 Configuring SSO Authentication Using

More information

PHP Integration Kit. Version 2.5.1. User Guide

PHP Integration Kit. Version 2.5.1. User Guide PHP Integration Kit Version 2.5.1 User Guide 2012 Ping Identity Corporation. All rights reserved. PingFederate PHP Integration Kit User Guide Version 2.5.1 December, 2012 Ping Identity Corporation 1001

More information

DTS Web Developers Guide

DTS Web Developers Guide Apelon, Inc. Suite 202, 100 Danbury Road Ridgefield, CT 06877 Phone: (203) 431-2530 Fax: (203) 431-2523 www.apelon.com Apelon Distributed Terminology System (DTS) DTS Web Developers Guide Table of Contents

More information

Glassfish, JAVA EE, Servlets, JSP, EJB

Glassfish, JAVA EE, Servlets, JSP, EJB Glassfish, JAVA EE, Servlets, JSP, EJB Java platform A Java platform comprises the JVM together with supporting class libraries. Java 2 Standard Edition (J2SE) (1999) provides core libraries for data structures,

More information

Volume 1: Core Technologies Marty Hall Larry Brown. An Overview of Servlet & JSP Technology

Volume 1: Core Technologies Marty Hall Larry Brown. An Overview of Servlet & JSP Technology Core Servlets and JavaServer Pages / 2e Volume 1: Core Technologies Marty Hall Larry Brown An Overview of Servlet & JSP Technology 1 Agenda Understanding the role of servlets Building Web pages dynamically

More information

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University Java Web Programming in Java Java Servlet and JSP Programming Structure and Deployment China Jiliang University Servlet/JSP Exercise - Rules On the following pages you will find the rules and conventions

More information

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code. Content Introduction... 2 Data Access Server Control Panel... 2 Running the Sample Client Applications... 4 Sample Applications Code... 7 Server Side Objects... 8 Sample Usage of Server Side Objects...

More information