JavaServer Pages (JSP)

Size: px
Start display at page:

Download "JavaServer Pages (JSP)"

Transcription

1 JavaServer Pages (JSP)

2 The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult to develop and maintain (the view) lack of flexibility lack of role separation: design designer

3 Example: HelloServlet.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Hello extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws IOException { response.setcontenttype("text/html"); } } PrintWriter out = new PrintWriter(response.getWriter()); out.println("<html>" + "<head><title>welcome!</title></head>" + "<body>" + "<h1><font color=\"red\"> Welcome! </font></h1>" + "<h2>current date and time:" + new java.util.date() + " </h2>" + "</body>" + "</html>"); out.close();

4 Example: hello.jsp <html> <head> <title>welcome!</title> </head> <body> <h1><font color="red"> Welcome! </font></h1> <h2>current date and time: <%= new java.util.date() %> </h2> </body> </html>

5 The Concept Standard component to create the presentation, that is conform to View Helper design pattern

6 JavaServer Pages (JSP) The standard solution to create web content easily that has both static and dynamic components Web pages Provides a natural, declarative, presentation oriented approach to creating static content Templates Are based on and benefit from all the dynamic capabilities of Java Servlet technology Every JSP is actually a servlet A first (small) step towards the role separation

7 The main features of JSP A JSP page is a text document that contains: static data (template) (HTML, SVG, WML, etc.) JSP elements, which construct the content JSP elements may be: JSP tags scriptles (code sequences written in Java...) JSP uses an expression language for accessing server-side objects The source files may be.jsp,.jspf,.jspx

8 The Life Cycle of a JSP Page

9 Translation Phase //Example taken from Apache Tomcat application server //This is the source file of the servlet generated for hello.jsp package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; implements javax.servlet.servlet public final class hello_jsp extends org.apache.jasper.runtime.httpjspbase implements org.apache.jasper.runtime.jspsourcedependent {... public void _jspservice(httpservletrequest request, HttpServletResponse response) throws java.io.ioexception, ServletException {... out.write("<html>");... out.write("</html>"); } }

10 JSP Syntax <%-- Hello World example, not again... --%> JSP Comment page language="java" contenttype="text/html; pageencoding="utf-8"%> <html> <head> <title>first JSP</title> </head> page import="java.util.date" %> include file="header.html" %> JSP Directives <%! String message = "Hello World"; %> <body> <% for(int i=1; i<=4; i++) { out.println("<h" + i + ">" + message + "</H" + i + ">"); } %> <!-- Page generated at: <%= new Date() %> --> </body> </html> JSP Expression JSP Declaration JSP Scriptlet

11 JSP Elements Element Standard Syntax XML Syntax Comment <% %> <! > Declarations <%!..%> <jsp:declaration>.. </jsp:declaration> Directives include.. %> page.. %> taglib.. %> <jsp:directive.include.. /> <jsp:directive.page.. /> xmlns:prefix="tag library URL" Expressions <%=..%> <jsp:expression>.. </jsp:expression> Scriptles <%..%> <jsp:scriptlet>.. </jsp:scriptlet> Standard actions <jsp:action>.. </jsp:action> <jsp:usebean>.. </jsp:usebean> <jsp:forward>.. </jsp:forward> <jsp:include>.. </jsp:include>.. Everything else besides the JSP elements is considered static content and it appears unaltered in the output. <html> <!-- this is static content --> Hello world! </html>

12 Scopes

13 JSP Objects Object Type Scope request HttpServletRequest REQUEST response HttpServletResponse PAGE application ServletContext APPLICATION pagecontext PageContext PAGE out JSPWriter PAGE config ServletConfig PAGE page (this) HttpJspPage PAGE session HttpSession SESSION exception Throwable PAGE

14 Examples of using JSP objects Get a parameter from the request <%= request.getparameter("nume") %> Get the IP address of the client and the type of his browser <%= request.getremoteaddr() %> <%= request.getheader("user-agent") %> <% session.setattribute("user", "Duke"); synchronized (application) { application.setattribute("sharedobject", new Object()); } out.println("<h1> Hello </h1>"); response.sendredirect(" response.senderror(404); %>

15 Exception Handling page errorpage="showerror.jsp" %> <html> <head> <title>error Handling Example</title> </head> <body> <% // Throw an exception to invoke the error page int x = 1; if (x == 1) { throw new RuntimeException("Boom!"); } %> </body> </html> Some JSP Page <%@ page iserrorpage="true" %> <html> <head> <title>show Error Page</title> </head> <body> <h1>opps...</h1> <p>sorry, an error occurred.</p> Error Handler <p>here is the exception stack trace: </p> <pre> <% exception.printstacktrace(response.getwriter()); %> </pre> </body> </html>

16 JSP Actions An action encapsulates some logic, that will be accesible using an XML tag The goal is: to eliminate scriptlets from a page to promote reusability There are two types of JSP actions: standard, of the form <jsp:action /> custom

17 JSP Standard Actions Accessing the Data Layer (The Model) <jsp:usebean> <jsp:setproperty> <jsp:getproperty> Dispatching the request... <jsp:forward> <jsp:include>

18 JavaBean Components Reusable components that encapsulate some data exposed as properties Described by classes that are public, serializable and have a default constructor JavaBeans are used to store information at a specific scope: request, session, etc. JSP Pages and Servlets will store and retrieve data using JavaBeans The Model

19 Example of a JavaBean package test; public class Person { Person is a bean private String name; private BigDecimal salary;... public String getname() { return name; } Name is a property public void setname(string name) { this.nume = nume; } }...

20 Standard Actions for JavaBeans Creating/Accessing an instance of the bean <jsp:usebean id="pers" class="test.person" scope="session" > pers.setname("duke");... </jsp:usebean> Accessing the properties of the bean <jsp:setproperty name="pers" property="name" value="joe" /> Person, your name is: <jsp:getproperty name="pers" property="name"/> A (small) step towards accesing the data layer without writing Java code...

21 Model 1

22 Using a JavaBean in a JSP <html> <jsp:usebean id="pers" scope="request" class="test.person" /> <%-- We use introspection to populate the bean --%> <jsp:setproperty name="pers" property="*" /> <% if ( request.getparameter("name") == null ) { %> <form method="get"> Nume: <input type="text" name="name" size="25" /> <br/> <input type="submit" value="ok"/> </form> <% } else { <!-- If we decide not to use introspection: <jsp:setproperty name="pers" property="name" value="<%= request.getparameter("name") %>" /> --> Salut, <jsp:getproperty name="pers" property="name" />! <% } %> </html>

23 Using a JavaBean in a servlet public void doget (HttpServletRequest request, HttpServletResponse response) { //Get the JavaBean from its scope Person person = (Person) request.getattribute("pers"); // Use the JavaBean person.setname("joe"); //Eventually, forward the request getservletcontext().getrequestdispatcher("result.jsp").forward(request, response); }

24 <jsp:forward page=... />

25 <jsp:include page=... /> include %> directive <jsp: include /> action

26 Request Chaining The first JSP of the chain maps the input elements of the form to the properties of the bean. <jsp:setproperty name="pers" property="name" value="*" />

27 Model View Controller

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

COMP9321 Web Application Engineering

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

More information

JSP - SYNTAX. Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP:

JSP - SYNTAX. Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP: http://www.tutorialspoint.com/jsp/jsp_syntax.htm JSP - SYNTAX Copyright tutorialspoint.com This tutorial will give basic idea on simple syntax ie. elements involved with JSP development: The Scriptlet:

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2465 1 Review:

More information

Java Server Pages JSP

Java Server Pages JSP Java Server Pages JSP Agenda Introduction JSP Architecture Scripting Elements Directives Implicit Objects 2 A way to create dynamic web pages Introduction Separates the graphical design from the dynamic

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1 CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 JSPs 1 As we know, servlets, replacing the traditional CGI technology, can do computation and generate dynamic contents during

More information

Java Server Pages. Copyright , Xiaoping Jia. 7-01/54

Java Server Pages. Copyright , Xiaoping Jia. 7-01/54 Java Server Pages What is Java Server Pages (JSP)? HTML or XML pages with embedded Java code to generate dynamic contents. a text-based document that describes how to process a request and to generate

More information

CE212 Web Application Programming Part 3

CE212 Web Application Programming Part 3 CE212 Web Application Programming Part 3 30/01/2018 CE212 Part 4 1 Servlets 1 A servlet is a Java program running in a server engine containing methods that respond to requests from browsers by generating

More information

JSP. Basic Elements. For a Tutorial, see:

JSP. Basic Elements. For a Tutorial, see: JSP Basic Elements For a Tutorial, see: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/jspintro.html Simple.jsp JSP Lifecycle Server Web

More information

JavaServer Pages. What is JavaServer Pages?

JavaServer Pages. What is JavaServer Pages? JavaServer Pages SWE 642, Fall 2008 Nick Duan What is JavaServer Pages? JSP is a server-side scripting language in Java for constructing dynamic web pages based on Java Servlet, specifically it contains

More information

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype=text/html; charset=windows-31j import=java.util.calendar %> A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp

More information

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

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

More information

Université du Québec à Montréal

Université du Québec à Montréal Laboratoire de Recherches sur les Technologies du Commerce Électronique arxiv:1803.05253v1 [cs.se] 14 Mar 2018 Université du Québec à Montréal How to Implement Dependencies in Server Pages of JEE Web Applications

More information

01KPS BF Progettazione di applicazioni web

01KPS BF Progettazione di applicazioni web 01KPS BF Progettazione di applicazioni web Introduction to Java Server Pages Fulvio Corno, Alessio Bosca Dipartimento di Automatica e Informatica Politecnico di Torino PAW - JSP intro 1 Introduction to

More information

1. Introduction. 2. Life Cycle Why JSP is preferred over Servlets? 2.1. Translation. Java Server Pages (JSP) THETOPPERSWAY.

1. Introduction. 2. Life Cycle Why JSP is preferred over Servlets? 2.1. Translation. Java Server Pages (JSP) THETOPPERSWAY. 1. Introduction Java Server Pages (JSP) THETOPPERSWAY.COM Java Server Pages (JSP) is used for creating dynamic web pages. Java code can be inserted in HTML pages by using JSP tags. The tags are used for

More information

Basic Principles of JSPs

Basic Principles of JSPs 5 IN THIS CHAPTER What Is a JSP? Deploying a JSP in Tomcat Elements of a JSP Page Chapter 4, Basic Principles of Servlets, introduced you to simple Web applications using servlets. Although very useful

More information

Java Server Page (JSP)

Java Server Page (JSP) Java Server Page (JSP) CS 4640 Programming Languages for Web Applications [Based in part on SWE432 and SWE632 materials by Jeff Offutt] [Robert W. Sebesta, Programming the World Wide Web] 1 Web Applications

More information

JavaServer Pages. Juan Cruz Kevin Hessels Ian Moon

JavaServer Pages. Juan Cruz Kevin Hessels Ian Moon Page 1 of 14 JavaServer Pages Table of Contents 1. Introduction What is JSP? Alternative Solutions Why Use JSP? 2. JSP Process Request Compilation Example 3. Object Instantiation and Scope Scope Synchronization

More information

Servlet Basics. Agenda

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

More information

Integrating Servlets and JavaServer Pages Lecture 13

Integrating Servlets and JavaServer Pages Lecture 13 Integrating Servlets and JavaServer Pages Lecture 13 Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall,

More information

Java Server Pages. JSP Part II

Java Server Pages. JSP Part II Java Server Pages JSP Part II Agenda Actions Beans JSP & JDBC MVC 2 Components Scripting Elements Directives Implicit Objects Actions 3 Actions Actions are XML-syntax tags used to control the servlet engine

More information

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

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

More information

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background

More information

Enterprise Computing with Java MCA-305 UNIT II. Learning Objectives. JSP Basics. 9/17/2013MCA-305, Enterprise Computing in Java

Enterprise Computing with Java MCA-305 UNIT II. Learning Objectives. JSP Basics. 9/17/2013MCA-305, Enterprise Computing in Java Enterprise Computing with Java MCA-305 UNIT II Bharati Vidyapeeth s Institute of Computer Applications and Management, New Delhi-63, by Ms. Ritika Wason UII. # Learning Objectives JSP Basics and Architecture:

More information

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming

More information

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

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

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

DEZVOLTAREA APLICATIILOR WEB LAB 4. Lect. Univ. Dr. Mihai Stancu

DEZVOLTAREA APLICATIILOR WEB LAB 4. Lect. Univ. Dr. Mihai Stancu DEZVOLTAREA APLICATIILOR WEB LAB 4 Lect. Univ. Dr. Mihai Stancu J S P O v e r v i e w JSP Architecture J S P L i f e C y c l e Compilation Parsing the JSP. Turning the JSP into a servlet. Compiling the

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 5049 Advanced Internet Technology Lab Lab # 10 JAVABEANS IN JSP El-masry May, 2014 Objectives Understanding JavaBeans.

More information

ServletConfig Interface

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

More information

Principles and Techniques of DBMS 6 JSP & Servlet

Principles and Techniques of DBMS 6 JSP & Servlet Principles and Techniques of DBMS 6 JSP & Servlet Haopeng Chen REliable, INtelligent and Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp

More information

Trabalhando com JavaServer Pages (JSP)

Trabalhando com JavaServer Pages (JSP) Trabalhando com JavaServer Pages (JSP) Sumário 7.2.1 Introdução 7.2.2 JavaServer Pages Overview 7.2.3 First JavaServer Page Example 7.2. Implicit Objects 7.2.5 Scripting 7.2.5.1 Scripting Components 7.2.5.2

More information

CIS 3952 [Part 2] Java Servlets and JSP tutorial

CIS 3952 [Part 2] Java Servlets and JSP tutorial Java Servlets Example 1 (Plain Servlet) SERVLET CODE import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet;

More information

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

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

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

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

More information

CSC309: Introduction to Web Programming. Lecture 10

CSC309: Introduction to Web Programming. Lecture 10 CSC309: Introduction to Web Programming Lecture 10 Wael Aboulsaadat WebServer - WebApp Communication 2. Servlets Web Browser Get servlet/serv1? key1=val1&key2=val2 Web Server Servlet Engine WebApp1 serv1

More information

Chapter 2 How to structure a web application with the MVC pattern

Chapter 2 How to structure a web application with the MVC pattern Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.

More information

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

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

More information

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

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

More information

JAVA 2 ENTERPRISE EDITION (J2EE)

JAVA 2 ENTERPRISE EDITION (J2EE) COURSE TITLE DETAILED SYLLABUS SR.NO JAVA 2 ENTERPRISE EDITION (J2EE) ADVANCE JAVA NAME OF CHAPTERS & DETAILS HOURS ALLOTTED SECTION (A) BASIC OF J2EE 1 FILE HANDLING Stream Reading and Creating file FileOutputStream,

More information

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

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

More information

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

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

More information

Java E-Commerce Martin Cooke,

Java E-Commerce Martin Cooke, Java E-Commerce Martin Cooke, 2002 1 Java technologies for presentation: JSP Today s lecture in the presentation tier Java Server Pages Tomcat examples Presentation How the web tier interacts with the

More information

JAVA SERVLET. Server-side Programming INTRODUCTION

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

More information

JSP CSCI 201 Principles of Software Development

JSP CSCI 201 Principles of Software Development JSP CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Outline JSP Program USC CSCI 201L JSP 3-Tier Architecture Client Server Web/Application Server Database USC

More information

Trabalhando com JavaServer Pages (JSP)

Trabalhando com JavaServer Pages (JSP) Trabalhando com JavaServer Pages (JSP) Sumário 7.2.1 Introdução 7.2.2 JavaServer Pages Overview 7.2.3 First JavaServer Page Example 7.2.4 Implicit Objects 7.2.5 Scripting 7.2.5.1 Scripting Components 7.2.5.2

More information

Advanced Internet Technology Lab # 4 Servlets

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

More information

Web applications and JSP. Carl Nettelblad

Web applications and JSP. Carl Nettelblad Web applications and JSP Carl Nettelblad 2015-04-02 Outline Review and assignment Jara Server Pages Web application structure Review We send repeated requests using HTTP Each request asks for a specific

More information

JSP Scripting Elements

JSP Scripting Elements JSP Scripting Elements Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall, http://, book Sun Microsystems

More information

Component Based Software Engineering

Component Based Software Engineering Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts

More information

Unit 5 JSP (Java Server Pages)

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

More information

Servlets and JSP (Java Server Pages)

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

More information

COMP201 Java Programming

COMP201 Java Programming COMP201 Java Programming Part III: Advanced Features Topic 16: JavaServer Pages (JSP) Servlets and JavaServer Pages (JSP) 1.0: A Tutorial http://www.apl.jhu.edu/~hall/java/servlet-tutorial/servlet-tutorial-intro.html

More information

JSP - ACTIONS. There is only one syntax for the Action element, as it conforms to the XML standard:

JSP - ACTIONS. There is only one syntax for the Action element, as it conforms to the XML standard: http://www.tutorialspoint.com/jsp/jsp_actions.htm JSP - ACTIONS Copyright tutorialspoint.com JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically

More information

JSP: Servlets Turned Inside Out

JSP: Servlets Turned Inside Out Chapter 19 JSP: Servlets Turned Inside Out In our last chapter, the BudgetPro servlet example spent a lot of code generating the HTML output for the servlet to send back to the browser. If you want to

More information

A JavaBean is a class file that stores Java code for a JSP

A JavaBean is a class file that stores Java code for a JSP CREATE A JAVABEAN A JavaBean is a class file that stores Java code for a JSP page. Although you can use a scriptlet to place Java code directly into a JSP page, it is considered better programming practice

More information

Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0

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

More information

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat

More information

directive attribute1= value1 attribute2= value2... attributen= valuen %>

directive attribute1= value1 attribute2= value2... attributen= valuen %> JSP Standard Syntax Besides HTML tag elements, JSP provides four basic categories of constructors (markup tags): directives, scripting elements, standard actions, and comments. You can author a JSP page

More information

Stateless -Session Bean

Stateless -Session Bean Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application

More information

Introduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages

Introduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages Introduction to Java Server Pages Jeff Offutt & Ye Wu http://www.ise.gmu.edu/~offutt/ SWE 432 Design and Implementation of Software for the Web From servlets lecture. Enabling Technologies - Plug-ins Scripted

More information

UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE

UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE NAME: CHAUHAN ARPIT S ENROLLMENT NO: 115250693055 Obtaining a RequestDispatcher Forwarding requests from servlets to dynamic resources Forwarding

More information

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet. Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;

More information

Introduction to JSP and Servlets Training 5-days

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

More information

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

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

More information

More JSP. Advanced Topics in Java. Khalid Azim Mughal Version date: ATIJ More JSP 1/42

More JSP. Advanced Topics in Java. Khalid Azim Mughal   Version date: ATIJ More JSP 1/42 More JSP Advanced Topics in Java Khalid Azim Mughal khalid@ii.uib.no http://www.ii.uib.no/~khalid/atij/ Version date: 2006-09-04 ATIJ More JSP 1/42 Overview Including Resources in JSP Pages using the jsp:include

More information

ADVANCED JAVA COURSE CURRICULUM

ADVANCED JAVA COURSE CURRICULUM ADVANCED JAVA COURSE CURRICULUM Index of Advanced Java Course Content : 1. Basics of Servlet 2. ServletRequest 3. Servlet Collaboration 4. ServletConfig 5. ServletContext 6. Attribute 7. Session Tracking

More information

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

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

More information

Advanced Java Programming

Advanced Java Programming Advanced Java Programming Length: 4 days Description: This course presents several advanced topics of the Java programming language, including Servlets, Object Serialization and Enterprise JavaBeans. In

More information

AJP. CHAPTER 5: SERVLET -20 marks

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

More information

Java Server Pages(JSP) Unit VI

Java Server Pages(JSP) Unit VI Java Server Pages(JSP) Unit VI Introduction to JSP Java Server Pages (JSP) is a server-side programming technology This enables the creation of dynamic, platform-independent method for building Web-based

More information

Handout 31 Web Design & Development

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

More information

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC) Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller

More information

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

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

More information

SWE642 Oct. 22, 2003

SWE642 Oct. 22, 2003 import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.arraylist; DataServlet.java /** * First servlet in a two servlet application. It is responsible

More information

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

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

More information

Lab session Google Application Engine - GAE. Navid Nikaein

Lab session Google Application Engine - GAE. Navid Nikaein Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone

More information

How to structure a web application with the MVC pattern

How to structure a web application with the MVC pattern Objectives Chapter 2 How to structure a web application with the MVC pattern Knowledge 1. Describe the Model 1 pattern. 2. Describe the Model 2 (MVC) pattern 3. Explain how the MVC pattern can improve

More information

Using Java servlets to generate dynamic WAP content

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

More information

Fast Track to Java EE

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

More information

A Gentle Introduction to Java Server Pages

A Gentle Introduction to Java Server Pages A Gentle Introduction to Java Server Pages John Selmys Seneca College July 2010 What is JSP? Tool for developing dynamic web pages developed by SUN (now Oracle) High-level abstraction of Java Servlets

More information

Advantage of JSP over Servlet

Advantage of JSP over Servlet JSP technology is used to create web application just like Servlet technology. It can be thought of as an extension to servlet because it provides more functionality than servlet such as expression language,

More information

Université du Québec à Montréal

Université du Québec à Montréal Laboratoire de Recherches sur les Technologies du Commerce Électronique Université du Québec à Montréal Rapport de recherche Latece 2017-3 Identifying KDM Model of JSP Pages Anas Shatnawi, Hafedh Mili,

More information

Unit 4 Java Server Pages

Unit 4 Java Server Pages Q1. List and Explain various stages of JSP life cycle. Briefly give the function of each phase. Ans. 1. A JSP life cycle can be defined as the entire process from its creation till the destruction. 2.

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Servlet Fudamentals. Celsina Bignoli

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

More information

20/08/56. Java Technology, Faculty of Computer Engineering, KMITL 1

20/08/56. Java Technology, Faculty of Computer Engineering, KMITL 1 Engineering, KMITL 1 Agenda What is JSP? Life-cycle of JSP page Steps for developing JSP-based Web application Dynamic contents generation techniques in JSP Three main JSP constructs Directives Error handling

More information

Integrating Servlets and JSP: The MVC Architecture

Integrating Servlets and JSP: The MVC Architecture Integrating Servlets and JSP: The MVC Architecture Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 2 Slides Marty Hall,

More information

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among

More information

JAVA. Web applications Servlets, JSP

JAVA. Web applications Servlets, JSP JAVA Web applications Servlets, JSP Overview most of current web pages are dynamic technologies and laguages CGI, PHP, ASP,... now we do not talk about client side dynamism (AJAX,..) core Java-based technologies

More information

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003 Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Module 4: SERVLET and JSP

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

More information

DVS WEB INFOTECH DEVELOPMENT TRAINING RESEARCH CENTER

DVS WEB INFOTECH DEVELOPMENT TRAINING RESEARCH CENTER DVS WEB INFOTECH DEVELOPMENT TRAINING RESEARCH CENTER J2EE CURRICULUM Mob : +91-9024222000 Mob : +91-8561925707 Email : info@dvswebinfotech.com Email : hr@dvswebinfotech.com 48, Sultan Nagar,Near Under

More information

SNS COLLEGE OF ENGINEERING, Coimbatore

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

More information

Java4570: Session Tracking using Cookies *

Java4570: Session Tracking using Cookies * OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract

More information

CSC309: Introduction to Web Programming. Lecture 11

CSC309: Introduction to Web Programming. Lecture 11 CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat Servlets+JSP Model 2 Architecture 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern 3 Servlets+JSP Model 2 Architecture Controller

More information

JSP. Common patterns

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

More information

JSP (Java Server Page)

JSP (Java Server Page) JSP (Java Server Page) http://www.jsptut.com/ http://www.jpgtutorials.com/introduction-to-javaserver-pages-jsp Lab JSP JSP simply puts Java inside HTML pages. Hello!

More information

Web Programming. Lecture 11. University of Toronto

Web Programming. Lecture 11. University of Toronto CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat University of Toronto Servlets+JSP Model 2 Architecture University of Toronto 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern

More information

JSP MOCK TEST JSP MOCK TEST IV

JSP MOCK TEST JSP MOCK TEST IV http://www.tutorialspoint.com JSP MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to JSP Framework. You can download these sample mock tests at your local

More information