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

Slides:



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

Java Server Pages (JSP)
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.
Apache Struts Technology
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.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
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,
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.
UNIT-V The MVC architecture and Struts Framework.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
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.
Netbeans – jsp.zip Introduction to JSP Netbeans – jsp.zip.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
CSC 2720 Building Web Applications Using Java Beans, Custom Tags and Tag Libraries in JSP pages.
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.
What Are Beans? beans are simply Java classes that are written in a standard format. A bean class must have a zero-argument (default) constructor. A bean.
JSP Java Server Pages Softsmith Infotech.
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.
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 CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
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 (JSP) Provide a cross-platform framework for creating dynamic web contents JSP Components: Static HTML/XML parts Special JSP Tags Snippets.
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 (JSP)
3/6/00jsp00 1 Java Server Pages Nancy McCracken Northeast Parallel Architectures Center at Syracuse University.
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.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
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.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
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 ( )
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.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
JAVA SERVER PAGES -by Rubeena Memon Deepti Jain Jaya Thakar Jisha Vettuventra.
 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.
JSP in Action. JSP Standard Actions forward, include, useBean, setProperty, getProperty, text, element, and plugin Additional actions param, params,
Chapter 14 Using JavaBeans Components in JSP Documents.
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.
Apache Struts Technology A MVC Framework for Java Web Applications.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Introduction to Server-Side Web JavaBeans; basic concepts and syntax.
JSP Action Elements Lec - 37.
Java Server Pages By: Tejashri Udavant..
Scripted Page Web App Development (Java Server Pages)
Scope and State Handling in JSPs
Pre-assessment Questions
Invoking Java Code from JSP
Introduction to Java Server Pages
Java Server Pages (JSP)
Java Server Pages B.Ramamurthy.
Introduction to JSP Dept. of B.Voc Software Development and System Administration St. Joseph’s College(Autonomous) Trichy-02 By Dr. J. Ronald Martin Introduction.
Scripted Page Web Application Development (Java Server Pages)
Presentation transcript:

 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages

 Copyright Wipro Technologies JSP Ver 1.0 Page 2 Talent Transformation Objectives At the end of this session, you will be able to: Distinguish JSP architecture vis-à-vis servlets Define and use the basic JSP Elements Create and use Java Beans Work with Cookies Define Session Tracking and use the same in JSPs

 Copyright Wipro Technologies JSP Ver 1.0 Page 3 Talent Transformation What is JSP JSP stands for Java Server Pages, a technology invented by Sun to allow the easy creation of server side HTML pages.

 Copyright Wipro Technologies JSP Ver 1.0 Page 4 Talent Transformation JSP Request Model

 Copyright Wipro Technologies JSP Ver 1.0 Page 5 Talent Transformation What makes JSP so attractive? High performance Convenient to code and maintain as against servlets Separates presentation from content Powered by Java –Has access to all Java APIs –Has access to all J2EE APIs –Inherent Platform independence

 Copyright Wipro Technologies JSP Ver 1.0 Page 6 Talent Transformation JSP compared to ASP Similarities –Both provide built in session tracking –Designed to create interactive pages in a Web application –Separate presentation logic from programming logic Differences –JSPs are designed for Platform independence and server independence –Open development process, has come through the JCP (Java Community Process) and hence broader acceptance –JSP enables developers to extend the tags –JSP uses a full fledged language like Java for scripting while ASP uses VBScript or Jscript, which are limited

 Copyright Wipro Technologies JSP Ver 1.0 Page 7 Talent Transformation The Architecture

 Copyright Wipro Technologies JSP Ver 1.0 Page 8 Talent Transformation The flow of JSP request

 Copyright Wipro Technologies JSP Ver 1.0 Page 9 Talent Transformation Elements of JSP The three basic elements of a JSP are: Scripting elements Directives Actions

 Copyright Wipro Technologies JSP Ver 1.0 Page 10 Talent Transformation Scripting Elements Lets you insert Java code into the servlet that will be generated from the current JSP page There are three forms: -Expressions -Scriptlets -Declarations

 Copyright Wipro Technologies JSP Ver 1.0 Page 11 Talent Transformation Expressions A JSP expression is used to insert Java values directly into the output. It has the following form:

 Copyright Wipro Technologies JSP Ver 1.0 Page 12 Talent Transformation Predefined Variables To simplify the expressions, there are a number of predefined variables that you can use The most important ones are: request response session out

 Copyright Wipro Technologies JSP Ver 1.0 Page 13 Talent Transformation Scriptlets Are defined as any block of valid Java code that resides between tags Code that is defined within a scriptlet can access any variable and any beans that have been declared

 Copyright Wipro Technologies JSP Ver 1.0 Page 14 Talent Transformation Declaration Used to define methods or fields that get inserted into the main body of the servlet class It has the form: The scope of a declaration is usually a JSP file, but if the JSP file includes other files with the include directive, the scope expands to cover the included files as well

 Copyright Wipro Technologies JSP Ver 1.0 Page 15 Talent Transformation Directives Affect the overall structure of the servlet class generated from this JSP. format: There are two main types of directives: – page –include

 Copyright Wipro Technologies JSP Ver 1.0 Page 16 Talent Transformation Page Directives Defines attributes that apply to an entire JSP page Lets you do things like: -Import classes -Handle error messages -Define if the JSP is thread-safe -Define is session object is available -Set the page content type

 Copyright Wipro Technologies JSP Ver 1.0 Page 17 Talent Transformation The Include Directive  Inserts the contents of another file in the main JSP file, where the directive is located  Useful for including copyright information, scripting language files, or anything you might want to reuse in other applications  The included file can be an HTML file, a JSP file, a text file, or a code file written in the Java programming language

 Copyright Wipro Technologies JSP Ver 1.0 Page 18 Talent Transformation Actions Control the behavior of the servlet engine You can dynamically insert a file, reuse JavaBeans components Available actions include: -jsp:include -jsp:forward -jsp:useBean

 Copyright Wipro Technologies JSP Ver 1.0 Page 19 Talent Transformation The jsp:include Action Lets you insert files into the page being generated The syntax looks like this: Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested

 Copyright Wipro Technologies JSP Ver 1.0 Page 20 Talent Transformation The jsp:forward Action Forwards a client request to an HTML file, JSP file, or servlet for processing. Syntax –

 Copyright Wipro Technologies JSP Ver 1.0 Page 21 Talent Transformation The jsp:useBean Action Lets you load in a JavaBean to be used in the JSP page The simplest syntax for specifying that a bean should be used is: This usually means "instantiate an object of the class specified by class, and bind it to a variable with the name specified by id."

 Copyright Wipro Technologies JSP Ver 1.0 Page 22 Talent Transformation Converts property names following the bean standards Has two attributes: -name ="beanInstanceName" The name of the Bean instance as declared in a tag -property ="propertyName" The name of the Bean property whose value you want to display

 Copyright Wipro Technologies JSP Ver 1.0 Page 23 Talent Transformation Sets the value of one or more properties in a JavaBean component Syntax: <jsp:setProperty name="beanInstanceName" property= "*" | property="propertyName" [param=parameterName" ] | property= "propertyName" value="{ string | }" } />

 Copyright Wipro Technologies JSP Ver 1.0 Page 24 Talent Transformation Properties of JSP:setProperty name property value param

 Copyright Wipro Technologies JSP Ver 1.0 Page 25 Talent Transformation Cookies Allow the web server to store small pieces of data on the client that can be sent back to the server on subsequent page requests Are often used to store user IDs or basic configuration information To read cookies from the browser, use the request.getCookies() function

 Copyright Wipro Technologies JSP Ver 1.0 Page 26 Talent Transformation Session Management JSP maintains session through the HttpSession object Session information is stored on the server, and a session ID number is stored in a cookie on the client machine Sessions are usually set by server default to expire after 30 minutes of user inactivity

 Copyright Wipro Technologies JSP Ver 1.0 Page 27 Talent Transformation Summary In this section, you have learnt to: Distinguish JSP architecture vis-à-vis servlets Define and use the basic JSP Elements Create and use Java Beans Work with Cookies Define Session Tracking and use the same in JSPs

 Copyright Wipro Technologies JSP Ver 1.0 Page 28 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 29 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 30 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 31 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 32 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 33 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 34 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 35 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 36 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 37 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 38 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 39 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 40 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 41 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 42 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 43 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 44 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 45 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 46 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 47 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 48 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 49 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 50 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 51 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 52 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 53 Talent Transformation

 Copyright Wipro Technologies JSP Ver 1.0 Page 54 Talent Transformation