1 Java Server Pages Can web pages be created specially for each user? What part does Java play?

Slides:



Advertisements
Similar presentations
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Advertisements

Time Scalability Single User Unlimited Users 100s of Users Several Users PC based Single user Late 1980sNow PC based, file-level locking Single user or.
Languages for Dynamic Web Documents
An architecture for webb applications, J2EE
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Server-Side vs. Client-Side Scripting Languages
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
INTERNET DATABASE Chapter 9. u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for.
Introduction to Web Application Architectures Web Application Architectures 18 th March 2005 Bogdan L. Vrusias
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Active Server Pages Chapter 1. Introduction Understand how browsers and servers interacted when the Web was young Understand what early Internet and intranet.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Java Server Pages B.Ramamurthy. Java Server Pages Servlets are pure Java programs. They introduce dynamism into web pages by using programmatic content.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
Comp2513 Java Server Pages Daniel L. Silver, Ph.D.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
8 Server Side Scripting.
UNIT-V The MVC architecture and Struts Framework.
Server-side Technologies
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
INTRODUCTION TO WEB DATABASE PROGRAMMING
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Applets & Servlets.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
CIS 285 ROBINSON WINTER 2005 CIS 285 Web Application Development with Java CIS 285 Sinclair Community College Instructor: Mary Robinson.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Modern Software Technologies Java™, J2EE™, JSP™, JDBC™ by Radoslav Tr. Ivanov
Introduction to Internet Programming (Web Based Application)
11/16/2012ISC329 Isabelle Bichindaritz1 Web Database Application Development.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
JSP Java Server Pages Softsmith Infotech.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Chapter 6 Server-side Programming: Java Servlets
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
MC365 Application Servers, Servlets, and Java Server Pages (JSP’s): Tomcat.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Java Servlets and Java Server Pages Norman White Stern School of Business.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Copyright © 2003 T. Trappenberg Overview B 1 B. Some tools of the trade Module 1 Technology: GR01E - Electronic Commerce Overview.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
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.
Apache Struts Technology A MVC Framework for Java Web Applications.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Java Server Pages Can web pages be created specially for each user?
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
Web App vs Mobile App.
Java Servlet Ziad A. Al-Sharif.
Java Server Pages (JSP)
Presentation transcript:

1 Java Server Pages Can web pages be created specially for each user? What part does Java play?

2 Java Server Pages Looking at …. –Introduction to JSP –Static web content –Dynamic web content –CGI –Servlet overview –Introduction to JSPs –JSP advantages –How a JSP works

3 Java Server Pages What is a Java Server Page (JSP)? –Java Server Pages is a Java-based technology that simplifies the process of developing dynamic web sites. –Java Server Pages are text files that contain HTML along with embedded code that allows Java code to be run on the server.

4 Static Web Content Server responds by sending index.htm to browser Browser Browser requests index.htm from server Web Server

5 Dynamic Web Content Browser 1 Browser requests sample.asp from server Web Server program 2 Server recognizes request as script or program 3 Program runs, getting information about the request from the server, interacts with server resources, and generates response (HTML tags) that is sent back to browser 4 Browser displays HTML it received from server.

6 CGI First standard for generating dynamic web content was Common Gateway Interface (CGI). –CGI specifies mechanism for servers to pass request information to external programs (i.e., external to the server software). –These programs were then run on server to generate responses sent back to browser. –Perl scripting language was popular choice, but could be in any language

7 CGI Principal problem with CGI is that each time a browser requests a CGI URL, the web server has to execute a separate instance/process of the CGI application. Browser Web Server CGI App 1 Why is this a problem - Does not scale well with large numbers

8 Server process for CGI Source: Duane Fields and Mark Kolb, Web Development with JSP (Manning Publications, 2000), p. 4

9 Template Systems Due to the inefficiencies with CGI, other dynamic content systems have been developed that avoid spawning separate processes for each request. –Microsoft's ASP (Active Server Pages), Allaire's ColdFusion, PHP, and Netscape's Server-Side JavaScript. All of these systems using scripting languages. –These languages are interpreted by the server rather than compiled using a compiler. –Advantage: rapid development times for developers. –Disadvantage: slower execution speed. All are template systems. –That is, scripts embedded within HTML. –HTML for static elements, scripts for dynamic elements.

10 Servlets 1996 Sun introduced Servlets as small Java-based applications for adding dynamic functionality to web servers. Servlets have programming model similar to CGI scripts in that they are given an HTTP request from a web browser as input, and are expected to construct the appropriate content for the server's response. Unlike CGI, Servlets do not spawn a new process for each request. Instead, all the Servlets run inside a single process that runs the Java Virtual Machine.

11 Server process using Servlets Source: Duane Fields and Mark Kolb, Web Development with JSP (Manning Publications, 2000), p. 8

12 Servlets One method for creating dynamic web sites via Servlets is to write Java code that outputs HTML data. Unfortunately, any change in design of web page, no matter how minor, requires of intervention of Java programmer, who must compile the code (and perhaps turn off server to deploy).

13 JSP Java Server Pages were created later (1999) by Sun to provide a simpler system for creating dynamic web pages. It uses the template approach of embedding programming code (that is run on the server) in the HTML page. It also uses the ColdFusion approach of unique HTML-like tags that interact with Java objects on the server.

14 JSP Hello Hello Value of I is Hello Hello <% for (int i=0; i<5; i++) { out.print("Value of I is "+i+" "); } %> Using JSP Tags The browser you are using is Year is

15 JSP Advantages (I) Since it uses Java, JSP enjoys advantages of Java (cross-platform, object-oriented, standard API libraries, etc). Better performance than CGI. –JSP requests are executed within a single Java servlet process/container. –Because all servlet and JSP requests share a single process they can share resources

16 JSP Advantages (II) JSP pages become compiled into class files by the servlet container, and thus (theoretically) may be quicker to execute than interpreted template systems. –As we will see, however, there are more steps in first-time processing a JSP page then an ASP page, so that frequently-changed JSP pages are significantly slower to execute.

17 JSP Advantages (III) Able to use JavaBeans to create object-oriented, component-based web applications. –ASP has same ability via ActiveX components created in Visual Basic (VB) or C++ A component is a stand-alone object representing a collection of properties and behaviors. –JavaBean properties and methods are accessed via HTML-like tags. Ideally components are reusable and self- contained. –Typically used to separate presentation from implementation/logic.

18 JSP and J2EE JSP is part of the Java Server API called the Java 2 Enterprise Edition (J2EE). JSP, along with Servlets, form the presentation layer of J2EE web applications.

19 JSP and J2EE Servlets JSP Presentation layerWeb container Session Beans Entity Beans EJB container Logic and data layers JDBC JNDI RMI JMS JAF JavaMail Service layer J2EE Application Server Source: Simon Brown et al, Professional JSP, 2 nd Edition (Wrox, 2001), p. 8

20 JSP Container To run JSP, software implementing a JSP container is required. –Tomcat which runs with Apache, IIS, etc –Oracle, IBM, Sun, etc's J2EE Application Server software also contains a JSP container.

21 How JSPs work When a request for JSP page is received, the Page Compiler container will parse the JSP page and turn it into Java Servlet source code (.java file). –However, if compiled servlet code for that JSP page already exists (and isn’t older than the JSP page), this step and the next step are skipped. The Java Servlet source code is then compiled by the Java compiler into a.class file.

22 How JSPs work ( contd ) The servlet (the.class file) is then loaded. The servlet will run (being interpreted by the JVM), interact with server resources, and generate responses (i.e., HTML) sent back to the browser.

23 JSP Server process

24 JSP reference Check out – –Contains many FAQ –Examples –Good web resource

25 Summary We have looked at: –Static and Dynamic web content –Dynamic web content –Introduction to CGI –Servlet overview –Introduction to JSPs –advantages –How a JSP works