Course Outcomes of Advanced Java Programming AJP (17625, C603)

Slides:



Advertisements
Similar presentations
Apache Tomcat as a container for Servlets and JSP
Advertisements

Java Server Pages (JSP)
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Servlets Stoney Jackson
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
An introduction to Java Servlet Programming
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
2/16/2004 Dynamic Content February 16, /16/2004 Assignments Due – Message of the Day Part 1 Due – Reading and Warmup Work on Message of the Day.
27-Jun-15 Directories and DDs. 2 Web apps A web application is basically a web site that: “Knows who you are”--it doesn’t just give you static pages,
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Java Servlets and JSP.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
SERVLETS.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Intro to Servlets Lec 26. Web-Based Enterprise Applications in Java Figure shows a simplified view of one application and its layers.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Functionality of a web server What does the web server do? Let a user request a resource Find the resource Return something to the user The resource can.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
SKT-SSU IT Training Center Servlet and JSP. Chapter Three: Servlet Basics.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
Chapter 2 Web app architecture. High-level web app architecture  When a client request coming in and needs servlet to serve dynamic web content, what.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
S ERVLETS Hits Counter 21-Nov-15. S ERVLETS - H ITS C OUNTER Many times you would be interested in knowing total number of hits on a particular page of.
Java Servlet API CGI / HTTP Concepts Java Servlet API.
@2008 Huynh Ngoc Tin Chapter #2 JAVA SERVLET PRGRAMMING.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
Configuration Web Server Tomcat - Install JDK Install Tom cat Configure Tom cat for running Servlet C:\Program Files\Apache Software Foundation\Tomcat.
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
1 Lecture 8 George Koutsogiannakis/Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
Introduction to Servlets
CS3220 Web and Internet Programming Introduction to Java Servlets
Introduction Servlets and JSP
Building Web Apps with Servlets
Java Servlets By: Tejashri Udavant..
Net-centric Computing
Servlets Hits Counter 20-Jul-18.
Introduction to Java Servlets on Jakarta Tomcat
Jagdish Gangolly State University of New York at Albany
Servlets and JSP 20-Nov-18 servletsJSP.ppt.
COP 4610L: Applications in the Enterprise Spring 2005
Representation and Management of Data on the Web
COP 4610L: Applications in the Enterprise Spring 2005
Java Servlets and JSP.
CS3220 Web and Internet Programming Introduction to Java Servlets
Servlets.
Installing Tomcat.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Introduction to Java Servlets
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Directories and DDs 25-Apr-19.
Basic servlet structure
Directories and DDs 21-Jul-19.
Directories and DDs 14-Sep-19.
Presentation transcript:

Course Outcomes of Advanced Java Programming AJP (17625, C603) Design GUI using AWT and Swing . C603.2 Develop program using event handling. C603.3 Use network concepts (client/server, socket) in the program. C603.4 Develop program using JDBC connectivity to access data from database and execute different queries to get required result. C603.5 Develop web based program using servlet and JSP Visit for more Learning Resources

Java Servlets and JSP

Server-side Java for the web a servlet is a Java program which outputs an html page; it is a server-side technology HTTP Request Server-side Request Java Servlet Java Server Page HTTP Response Response Header + Html file browser web server servlet container (engine) - Tomcat

First java servlet import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class FirstServlet 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>"); out.println("<title>First servlet</title>"); out.println("</head>"); out.println("<body>"); out.println("It works...<hr>"); out.println("</body>"); out.println("</html>"); }

What is a java servlet ? a java servlet is a java class extending HTTPServlet class a java servlet class implements the doGet(), doPost() or other equivalent HTTP method and (usually) prints at the standard output an html file a java servlet class can contain any kind of java code the JDK can compile a java servlet class needs to be compiled prior to using it; it must use servlet-api.jar

Apache Tomcat the most well known servlet/jsp container is a web server + implementation of Java Servlet and JSP (Java Server Pages) APIs is developed by Apache Software Foundation available at http://tomcat.apache.org/ under Apache Software License

Installing Tomcat 1. Download the binary zip distribution (e.g. apache- tomcat-6.0.20.zip) in a local folder (we will use c:\temp in the rest of the guide) 2. Set the environment variables JAVA_HOME=path_to_JDK_installation_folder CATALINA_HOME=path_to_tomcat_installation_folder either as Windows system variables or in the files startup.bat and shutdown.bat from the bin directory Ex. place the following lines in the beginning of startup.bat and shutdown.bat: set JAVA_HOME=c:\progra~1\java\jdk1.6.0 set CATALINA_HOME=c:\temp\apache-tomcat-6.0.20

Starting/shutting down Tomcat start Tomcat from a cmd prompter (window): c:\temp\apache-tomcat-6.0.20\bin\startup.bat verify startup by pointing a browser to the url http://localhost:8080 shutting down Tomcat from a cmd prompter (window): c:\temp\apache-tomcat-6.0.20\bin\shutdown.bat

Tomcat standard folders bin – contains executable files for controlling the server (start, shut down etc.) conf – contains configuration files; most important server.xml for configuring the server and web.xml a general configuration file for web applications lib – libraries (jars) used by tomcat and deployed web applications logs – log files temp – temporary files webapps – contains the web applications deployed work – contains files created by tomcat during running (e.g. it crates a servlet from each jsp file)

Format of a web application web applications are stored in the webapps folder, either as a folder or as a .war archive a web application (either a folder or a .war archive) must contain the following files: WEB-INF folder WEB-INF\web.xml: a configuration file optionally the WEB-INF folder can contain the following subfolders: classes: which contain servlets lib: which contains jars used by the web application html, jsp and resource files can be placed anywhere in the web application home folder servlets must be placed in the folder or subfolders of WEB-INF\classes

A very simple web.xml example <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd version="2.5"> </web-app>

Configuring servlets for JSPs (Java Server Pages) no additional configuration needs to be done for java servlets additional lines must be placed in the web.xml file: <servlet> <servlet-name>ServletsName</servlet-name> <servlet-class>The_Class_Name_of_the_Servlet</servlet-class> </servlet> <servlet-mapping> <servlet-name> ServletsName </servlet-name> <url-pattern>/URL_of_the_servlet</url-pattern> </servlet-mapping>

First JSP file <html> <body> <% out.println(“First JSP… It works<br/>"); %> </body> </html>

What is a Java Server Page (JSP) an html file containing parts of java code; the java code is placed inside the “<% … %>” tags or some other related tags Tomcat will create a servlet from the jsp file (which will be saved in the work folder) when the jsp is requested the servlet is executed and the output of the server is sent back to the client

Additional documentation for Servlets: http://www.cs.ubbcluj.ro/~florin/PDPJ/ExempleSurseDocumentatii/07JavaServlet.pdf for JSP: http://www.cs.ubbcluj.ro/~florin/PDPJ/ExempleSurseDocumentatii/08JavaServerPages.pdf examples of both: http://www.cs.ubbcluj.ro/~forest/wp/JSP%20Servlet%20examples For more detail contact us