Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.

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.
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.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
CS320 Web and Internet Programming JSP Scripting Elements and Page Directives Chengyu Sun California State University, Los Angeles.
JSP Java Server Pages Reference:
DT228/3 Web Development JSP: Directives and Scripting elements.
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 Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
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.
JavaServer Pages TM Introduce by
8 Server Side Scripting.
UNIT-V The MVC architecture and Struts Framework.
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
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,
JavaServer Pages Syntax Harry Richard Erwin, PhD CSE301/CIT304.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Web Applications Harry R. Erwin, PhD University of Sunderland CIT304/CSE301.
COSC 617 Jeff Schmitt September 28, 2006
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.
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.
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)
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
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,
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
SDPL 2001Notes 7.2: Apache Cocoon1 7.2 Apache Cocoon An example of a Web publishing architecture based on XML technology An.
Writing Enterprise Applications with J2EE (Fourth lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Java Server Pages An introduction to JSP. Containers and Components Several clients – one system.
CSC 2720 Building Web Applications JavaServer Pages (JSP) JSP Directives and Action Elements.
JSP. Types of JSP Scripting Elements Expressions of the form, which are evaluated and inserted into the servlet's output. Scriptlets of the form, which.
Web Technologies Java Beans & JSP By Praveen Kumar G.
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.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
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.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
Java Servlets and Java Server Pages
CSI 3125, Preliminaries, page 1 JSP (Java Server Pages)
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.
 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,
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.
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.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
World Wide Web has been created to share the text document across the world. In static web pages the requesting user has no ability to interact with the.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Knowledge Byte In this section, you will learn about:
MSIS 655 Advanced Business Applications Programming
Java Server Pages (JSP)
Java Server Pages B.Ramamurthy.
JSP Directives 1-Jan-19.
Presentation transcript:

Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301

Review Last lecture, we examined the use of Java servlets as a way to provide dynamic content. Problems: –Requires fully-qualified Java programmers (£) –Tedious and error-prone (£) –Time-consuming and requires frequent update (££) –Adding a new servlet involves editing XML and restarting the application (£) –Mixing static HTML with servlets does not scale (£). This lecture, we will examine the use of JavaServer Pages to overcome these problems.

Resources Farley, Crawford, and Flanagan, 2002, Java Enterprise in a Nutshell, second edition, O’Reilly, ISBN: For programmers. Bergsten, 2002, JavaServer Pages, second edition, O’Reilly, ISBN: X. Covers JSP 1.2, for both programmers and web page authors. Has lots of worked examples. Recommended. If you have to manage web application development, it won’t hurt you to know something about the process.

JavaServer Pages (JSP) Allow you to embed the dynamic elements into the static content. Can be edited using a text editor or HTML authoring tool. Can be previewed live in the various browsers that you plan to support.

Template Engines Resources Template Processor Web Server Web Browser Instruction Template

Java and JSP JSP pages are compiled into Java servlets before being executed. Benefits –More efficient lifecycle –Integration with Java –Easy use of JavaBeans without writing code –Java code can be completely avoided. –Avoids programming.

JSP Basics Individual JSP pages are text files stored on the web server. When a page is first requested, the JSP engine uses the page to generate a servlet. The compiled servlet is saved and used to handle later requests. When a page is modified, the servlet is recreated. Precompilation of pages is also feasible.

A Simple JSP (from Java Enterprise in a Nutshell) Hello, sailor, it is now The only non-self-evident element is the: “new java.util.Date().toString()” This creates a date object and converts it to a String that can be displayed. The tag is are used to display a Java variable. XML syntax can also be used, if you want to be open to the future.

Points to Note More generally, the elements (HTML/XML comments) can be used to insert regular Java code to control the flow of a page. We will discuss this in more detail next lecture. The next slide gives an example of an ‘if, then, else’ flow control construct used in a JSP page. This is also from Java Enterprise in a Nutshell.

Java Flow Control Good morning, Good afternoon, sailor. It is now.

Java APIs Available JDBC (=ODBC) RMI and CORBA Java Naming and Directory Interface Enterprise JavaBeans Java Message Service Java Transaction API JAXP JavaMail

JSP Directives Affect the entire page. Begin with or –Used to include static content –Used to set page parameters –Declares a tag library (later…)

Important Page Directives contentType –MIME type of the page, default: text/html extends –JspPage class to be used if not default. import –Java classes or packages to import. info –A description of JSP page. session –Indicates whether page participates in a user session.

Declaration Elements This is another type of tag used to create variables. These are defined at the level of the JSP rather than at the session level. They persist across invocations. They can be used to count hits and detect hacking. Not all that useful. Use other approaches, if the data need to persist whenever the JSP is rebuilt and reloaded.

Built-ins Your web server provides classes that the JSP can use. These include: –Configuration data –The standard output stream –The request that created the invocation –The response being generated –The current user’s session record.

What’s in it for the Web Designer? JSP supports action tags. These are regular HTML tags of two types: –Built-in functions –Custom tags Built-in functions use XML namespace- enabled tag syntax. They work with JavaBeans, too.

Standard Action Tags imports a JavaBeans component. gets a property value and adds it to the response. sets a property value. includes the response from a servlet or JSP page that is called for the request. forwards the call to a servlet or JSP page for service. adds a parameter to a request. generates the OBJECT or EMBED tag for an applet.

taglib Directives If the web site architect wants to extend the JSP tag syntax, she can also define custom action tags. These are organized into Tag Libraries and can be loaded using the taglib directive. This allows her to remove almost all Java code from the JSPs. Her web page developers use these custom tags to replace the calls to Java functions, beans and programs. The programmers can then do their jobs separately from everyone else.

Conclusions JSP is a solution to providing dynamic content. Equivalent to ASP.NET but currently more popular. Can be used to avoid Java scripting. Next lecture: –Java programming basics—just enough to let you organize your JSP pages—there is no requirement to learn class or method syntax unless you want to provide programming support to a web design organization.