Michael Brockway Application Integration JavaServer Pages l Introduction & Overview l Implicit Objects l Scripting l Standard Actions l Directives l References.

Slides:



Advertisements
Similar presentations
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Advertisements

Java Server Pages Jeffrey Jongko. Introduction Java Server Pages (JSP) technology was created by Sun Microsystems and is built on top of Sun’s Java Servlet.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Introduction to Java Server Page (JSP) Yoshi. What is JSP JSPs have dynamic scripting capability that works in tandem with HTML code, separating the page.
CS320 Web and Internet Programming JSP Scripting Elements and Page Directives Chengyu Sun California State University, Los Angeles.
Java Server Pages B.Ramamurthy. Java Server Pages Servlets are pure Java programs. They introduce dynamism into web pages by using programmatic content.
Comp2513 Java Server Pages Daniel L. Silver, Ph.D.
1 CS6320 – JSP L. Grewe 2 Java Server Pages Servlets require you to write out entire page delivered with print statements Servlets require you to write.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
 2002 Prentice Hall. All rights reserved. JavaServer Pages.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
Java Server Pages CS-422. What are JSPs A logical evolution of java servlets –most servlets dynamically create HTML and integrate it with some computational.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
Introduction to Java Server Pages (JSPs) Robert Thornton.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 25: JavaServer Pages Outline 25.1 Introduction 25.2 JavaServer Pages Overview 25.3 First JavaServer.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
Jordan Anastasiade. All rights reserved.
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
JSP Most of the web developers deploying web applications using servlets mixes the presentation logic and business logic. Separation of business logic.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Stanisław Osiński, 2002JSP – A technology for serving dynamic web content Java Server Pages™ A technology for serving dynamic web content Stanisław Osiński,
16-Oct-15 JSP Implicit Objects. 2 JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer.
intro JSP Pertemuan 8 Matakuliah: Web Programming Tahun: 2009.
Writing Enterprise Applications with J2EE (Fourth lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
 2005 Pearson Education, Inc. All rights reserved JavaServer Pages (JSP)
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaServer Page.
CSC 2720 Building Web Applications JavaServer Pages (JSP) The Basics.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Java Server Pages An introduction to JSP. Containers and Components Several clients – one system.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Java Server Pages Introduction. Servlet Drawbacks Web page designer will need to know servlets to design the page. Servlet will have to be compiled for.
CSC 2720 Building Web Applications JavaServer Pages (JSP) JSP Directives and Action Elements.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
JSP JavaServer Pages. What is JSP? Java based technology that simplifies the development of dynamic web sites JSP pages are HTML pages with embedded code.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Java Server Pages.
Java Server Pages By: Tejashri Udavant..
Pre-assessment Questions
Introduction to JSP Java Server Pages
Knowledge Byte In this section, you will learn about:
JSP(Java Server Pages)
Invoking Java Code from JSP
JavaServer Pages (JSP)
MSIS 655 Advanced Business Applications Programming
COP 4610L: Applications in the Enterprise Spring 2005
JSP implicit objects & directive elements
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Michael Brockway Application Integration JavaServer Pages l Introduction & Overview l Implicit Objects l Scripting l Standard Actions l Directives l References

2 Introduction l References: Deitel & Deitel Java chap 25; Liang, Java Programming, chap 40 l JavaServer Pages (JSPs) are a way of simplifying the delivery of dynamic web content n Underneath, they are servlets, but you do not program them in Java; n Rather, you write XHTML documents with embedded u directives u actions u Scriptlets (fragments of Java code) u tag libraries n Accessible to non Java programmers Even experienced Java programmers are prone to errors when writing a lots of printlln(...) statements to a reponse object’s printWriter, in order to create a dynamic web page: it is easier to write the web page and embed the dynamic bits.

3 Introduction l When a JSP-enabled server receives a request for a JSP n The JSP container (within the server) translates the JSP into a Java servlet n The servlet handles the current and future requests for this JSP n Errors compiling the servlet result in translation-time errors. JSP container places the Java statements that implement the JSP’s response in method _jspService at translation time. If the JSP compiles correctly, the JSP container invokes method _jspService to process the request. u May respond directly; or u May invoke other Web application components l A first example – clock.jsp n Deploy in Tomcat u...webapps\jspexs\jsp\clock.jsp  jspexs is the context root for the present jsp examples n In web browser, go to u

4 Implicit Objects l A JSP page is XHTML with embedded pieces of Java. These java statements can refer to a number of implicit objects associated with the page, or the HTTP request which led to the production of the page, or with the browser session. n javax.servlet.ServletContext application u This object represents the container in which the JSP executes u Scope is “global” – any servlet or JSP in this container can access it n javax.servlet.ServletConfig config u Represents the JSP configuration options u Has page scope: exists just in the current page n java.lang.Throwable exception u Passed to a JSP error page; has page scope. javax.servlet.jsp.JspWriter out (page scope) u Writes text in response to a request u Used implicitly with JSP expressions and actions that output string content java.lang.Object page (page scope)  The this reference

5 Implicit Objects l Implicit objects (ctd) javax.servlet.jsp.PageContext pageContext (page scope) u Hides implementation of page’s underlying servlet u Provides access to these implicit objects javax.servlet.http.HttpServletResponse response (page scope)  Or some class that implements javax.servlet.ServletResponse u Implements response to client javax.servlet.http.HttpServletRequest request  Or some class that implements javax.servlet.ServletRequest u Has request scope: accessible to all pages which are part of this request u Represents the client request javax.servlet.http.HttpSession session u Represents client session information u Has session scope – the clients entire brwosing session

6 Scripting l You write XHTML with embedded JSP scripting components n Scriptlets  blocks of Java code delimited by.  Java expressions delimited by.  Placed in method method _jspService a translation time. n 3 kinds of comments  XHTML comments go between and can go anywhere in a JSP except inside scriptlets  JSP comments go between and can go anywhere in a JSP except inside scriptlets; do not appear in response to client  Java comments between /* and */ or between // and end-of-line can go inside scriptlets n Escape sequences  If you want a literal, use %\>  For literal ', ", \ use escape sequences \', \", \\

7 Scripting See scripting example welcome.jsp n Deploy in Tomcat u …\webapps\jspexs\jsp\welcome.jsp n u or n

8 Standard Actions See examples listed at end of these notes l n Dynamically include another referenced resource in a JSP l n Forwards request to another JSP or servlet or static page. n Terminates current processing l n Adds a browser-specific object to a page l <jsp:param n Use with the 3 actions above to specify parameters as name,value pairs l n Specifies that the page uses a given JavaBean instance: n Specifies scope of bean n Assigns it an ID that scripting components can refer to l n in a given JavaBean instance l n in a given JavaBean instance n Converts to String for output to response

9 Directives l Messages to the JSP container allowing programmer to specifiy page settings Delimited by l Processed at translation time include Directive n See example includeDirective.jsp l Guest Book case study n GuestBean.java n GuestDataBean.java n guestBookLogin.jsp n guestBookView.jsp n guestBookErrorPage.jsp

10 Further Reading l WWW Resources n Look at the links from Java Enterprise Edition documentationhttp://java.sun.com/ n JavaServer Pages specification u n Tutorial u n The API referece u u Look up packages javax.servlet.jsp and javax.servlet.jsp.tagext l The Deitel et al and Liang textbook references cited above.