Introduction To HTML Dr. Magdi AMER. HTML elements.

Slides:



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

Java Server Pages (JSP)
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Server Side Programming Common Gateway Interface (CGI): Scripts generate Web pages or other files dynamically by processing form data and returning documents.
1 CS6320 – Servlet Request Dispatcher L. Grewe 2 What is the purpose Forward a request from one servlet to another (or jsp). Forward a request from one.
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
CSE 190: Internet E-Commerce Lecture 7. HTML Templates Designed to separate server side logic from HTML presentation Key features –Escapes from HTML into.
An introduction to Java Servlet Programming
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
June 1, 2000 Object Oriented Programming in Java (95-707) Advanced Topics 1 Lecture 10 Object Oriented Programming in Java Advanced Topics Servlets.
Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password: In Netbeans you can graphically create.
1 CS6320 – Servlet Structure and Lifecycle L. Grewe.
Introduction to Servlet & JSP
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
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 Written by Dr. Yaron Kanza, Edited by permission from author by Liron Blecher.
CSCI 6962: Server-side Design and Programming History and Background.
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.
Servlet and JSP Programming: An Introduction Spiros Papadimitriou
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Servlets Pranav Maydeo. What is a Servlet ? Servlets are modules of Java code that run in a server application to answer client requests. Servlets are.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Objectives Java Servlet Web Components
CSC 2720 Building Web Applications
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
Chapter 7 Java Server Pages. Objectives Explain how the separation of concerns principle applies to JSP Describe the operation and life-cycle of a JSP.
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Servlet Lifecycle Lec 28. Servlet Life Cycle  Initialize  Service  Destroy Time.
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
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.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
JavaServer Page by Antonio Ko. Overview ► Introduction ► What is a servlet? ► What can servlets do? ► Servlets Vs JSP ► Syntax ► Samples ► JavaBean ►
JSP Pages. What and Why of JSP? JSP = Java code imbedded in HTML or XML –Static portion of the page is HTML –Dynamic portion is Java Easy way to develop.
Servlets.
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.
ORIGINAL BY WENDY LIU CURRENT API: Java Servlet and JSP 1.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
Configuration Web Server Tomcat - Install JDK Install Tom cat Configure Tom cat for running Servlet C:\Program Files\Apache Software Foundation\Tomcat.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
Java and the Web CSE 3330 Southern Methodist University.
Java Servlets and Java Server Pages
ClaRA web services V. Gyurjyan Clas12 Software Meeting
How CGI and Java Servlets are Run By David Stein 14 November 2006.
 Java Server Pages (JSP) By Offir Golan. What is JSP?  A technology that allows for the creation of dynamically generated web pages based on HTML, XML,
April 20023CSG11 Electronic Commerce Java (2) John Wordsworth Department of Computer Science The University of Reading Room 129,
J2EE/Java EE Apache Tomcat v9 IBM Websphere v8 Redhat JBoss EAP v6 Oracle Weblogic v12 Fusion Web Tier ServletsJSPJSF Business Tier JMXJMSEJB.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
Introduction to Servlets
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Net-centric Computing
Session Tracking in Servlets
HTTP Servlet Overview Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might.
Java Server Pages.
Servlets and Java Server Pages
Web Search Interfaces.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Basic servlet structure
Presentation transcript:

Introduction To HTML Dr. Magdi AMER

HTML elements

Tables

click here Links

Forms

Web Architecture 7

An HTTP request has three parts, separated by spaces: – A method name – The local path of the requested resource (URI) – The version of HTTP being used GET /reports/sales/index.html HTTP/1.1 If parameters are required, they are passed by appending a query string to the URI name1=value1&name2=value2&…&nameM=valueM HTTP Get Request 8

In POST, the parameters are sent in the message body, unlike in GET, in which they are a part of the request URI. Post result cannot be bookmarked, while get result can be bookmarked. HTTP Post Request 9

package com.amer; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res);} public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println(" "); out.println(" Hello World "); out.println(" "); out.println(" Hello World "); out.println(" "); }} First Servlet 10

– As a link:  always GET go – As a form action  can choose GETor POST …. Calling a Servlet 11

//Single parameter String uname= request.getParameter("uname"); String gender = request.getParameter(“gender”); If(gender == null) gender=“”; //Multi parameters String[] langs = request.getParameterValues("lang"); if(langs==null) langs = new String[0]; Reading Parameters 12

Input type: text, password, hidden, single combo, text area  single, never null Input type: radio, submit  single, may be null Input type: checkbox, multi combo  multi, may be null Parameters Types 13

HelloWorld eg.edu.ufe.tic4.HelloWorld HelloWorld /hi HelloWorld *.php web.xml 14

History of the web 15

Class Variable (static) Instance Variable Function Variable Single Threaded SharedUnique Multi- Threaded Shared Unique Handling Multi-threads 16

Handling Multi-treading 1- do not use instence variables or shared objects in servlets 2- If really necessary use synchronized synchronized(this) { int y= x; // x is an instance variable, shared between multiple threads // y is a function variable, unique for each thread y = y+100; x = y; } 17

page contentType="text/html;charset=UTF-8" import="com.amer.*”%> <% //java code out.println(“ NAME”); %>  JSP 18

JSP to Servlet import com.amer.*; public class JspToServlet extends HttpServlet { //variable and function declaration public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res);} public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); res.setContentType("text/html"); res.setCharacterEncoding(“UTF-8”); //java code out,print(“ NAME”): out.print(variable); out.println(“ ”); } 19

Dispatching request from Servlet to JSP RequestDispatcher dispatcher = this.getServletContext(). getRequestDispatcher("/Login.jsp"); dispatcher.forward(request, response); 20

Passing data from Servlet to JSP //Servlet 1 Vector list = null; //………… request.setAttribute(“list”, list); //JSP <% Vector list = (Vector ) request.getAttribute(“list”); %> 21

Sessions //to create a session HttpSession session = req.getSession(true); User u = new User(); //any object // to store a value in the session session.setAttribute(“user”, u); //////////////////////////////////// //To obtain an instance of an existing session HttpSession session = req.getSession(); // to read a value User u = (User) session.getAttribute(“user”); 22