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.

Slides:



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

Java Script Session1 INTRODUCTION.
CS4273: Distributed System Technologies and Programming I Lecture 11: JavaServer 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.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Michael Brockway Application Integration JavaServer Pages l Introduction & Overview l Implicit Objects l Scripting l Standard Actions l Directives l References.
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.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
DT211/3 Internet Application Development
CS320 Web and Internet Programming JSP Scripting Elements and Page Directives Chengyu Sun California State University, Los Angeles.
DT228/3 Web Development JSP: Directives and Scripting elements.
Including Files & Applets in JSP Documents Parts of this presentation provided by: Vijayan Sugumaran Decision and Information Sciences.
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 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.
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.
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.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
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.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
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,
Slides © Marty Hall, book © Sun Microsystems Press 1 Including Files & Applets in JSP Documents Core Servlets & JSP book:
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
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.
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)
JSP Most of the web developers deploying web applications using servlets mixes the presentation logic and business logic. Separation of business logic.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
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 (JSP)
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.
© 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.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
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.
1 Chapter 27 JavaServer Page. 2 Objectives F To know what is a JSP page is processed (§27.2). F To comprehend how a JSP page is processed (§27.3). F To.
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,
JSP Directive and Objects. JSP Directives As discussed before There are 3 types of elements in JSP Directive Elements Scripting Elements Standard Action.
JSP Java Server Pages. Hello, !
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Developing JavaServer Pages
Java Server Pages.
Java Server Pages By: Tejashri Udavant..
Scripted Page Web App Development (Java Server Pages)
Including Files and Applets in JSP Pages
Pre-assessment Questions
Knowledge Byte In this section, you will learn about:
Invoking Java Code from JSP
MSIS 655 Advanced Business Applications Programming
Java Server Pages.
JSP Directives 1-Jan-19.
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)
Web Technologies Java Beans & JSP
Presentation transcript:

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 and database output Servlets on their own had some pretty stiff competition form PHP, ASP and ColdFusion –these technologies for the most part (especially ColdFusion) don’t need a programmer; ASP and PHP definitely have a programming language in their background but scripting in VBScript or PHP is still easier than Java some one at Sun recognized that a servlet was just some Java with HTML embedded in it, and thought: why not embed some Java in regular HTML; then create a class that will scan through it and make the source code for a servlet, then compile it and deploy it The Java Server Page is born

An Example... Processing "get" requests with data <% // begin scriptlet String name = request.getParameter( "firstName" ); if ( name != null ) { %> Hello, Welcome to JavaServer Pages! <% // continue scriptlet } // end if else { %> Type your first name and press Submit <% // continue scriptlet } // end else %>

The rendered screen(s)... After entering Dick...

Embedding Java in HTML Embedding Java in HTML is pretty simple; the lead is taken from PHP and ASP; we’ll make a special escape character “ ” the tag pair are used for defining scriptlets; a sequences of Java statements –scriptlets are used to glue the parts of your jsp together (see prev. example) the tag pair is used for Java expression evaluation –ex will be replaced with the current Date/Time

JSP Directives page taglib include

page directive Language – “scriptingLanguage” Extends – “classname” Import – “importList” – java.lang.*, javax.servlet.*, javax.servlet.jsp.*, and javax.servlet.http.* are imported implicitily Session “true|false” Buffer – “none|sizekb” autoFlush- “true|false” isThreadSafe – “true|false” Info – “info_text” errorPage – “error_URL” isErrorPage – “true|false” contentType – “contentInfo” pageEncoding – “pageEncodingInfo”

taglib directive Import a taglib into the page Associate taglib with a URI Map the URI to,a prefix for use within the page

include directive Allows the inclusion of another file into the defining page Happens at translation time.

JSP Actions (Tags) JSP provides a set of standard actions to help you with commonly done tasks: –

Attributes: –page - specifies the relative URI path to the resource to include –flush - must be “true” ; specifies whether the buffer should be flushed after the include is performed – –use this action to include dynamic content; it will be included each time it is included there is also an include directive – –use this for including static content, is included only once

Allows you to forward processing to another JSP, as soon as processing is forwarded the processing of the curreent JSP is terminated can be used in conjunction with to forward parameter information to the forwarded JSP ” />

Adds an applet or JavaBean to a Web page in the form of a browser=specific object or embed XHTML element. It also allows the client to download and install the java Plug-in if it is not already present. Attributes: –type - bean or applet –code - Class that represents the component –codebase- location of the class specified in the code attribute and the archives specified in the archives attribute –align - Alignment od the component (left,right,center) –archive - space separated list of archives (JARS) containing resources –height - component height in pixels –hspace - number of pixels to right and left of component –jreversion - version of the JRE required –name - name of component –vspace - number of pixels above and below the component –title - Text describing the component –width - component width in pixels or percent –nspluginurl - location of plugin for Netscape Navigator –iepluginurl - location of plugin for Internet Explorer

Enables a JSP to manipulate or use a JavaBean. The action creates or locates an existing object for use in the JSP. Attributes: –id - the name used to manipulate the Java object (case sensitive) –scope - page, request,session,or application (default is page) –class - fully qualified class name of the Java object –beanName - The name that can be used with method instantiate of class java.beans.Beab to load a JavaBean into memory. –Type - type of JavaBean, can be same as class attribute, a superclass of that type or an interface implemented by that type

Used to set Bean property values Attributes: –name - Id of the Bean for which a property is to be set –property - name of the property to set –param - specify which request parameter is to be used –value - the value to assign to a Bean proberty

retrieve the value of a Bean property attributes: –name - the name of the Bean –property - the name of the property to retrieve