JSP implicit objects & directive elements

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.
The JSP Directives Vijayan Sugumaran School of Business Administration Oakland University Parts of this lecture provided by Coreservlets.com.
DT211/3 Internet Application Development
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 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.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
1 Chapter 1: Overview of Servlets and JavaSerevr 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.
Introduction to Java Server Pages (JSPs) Robert Thornton.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
Jordan Anastasiade. All rights reserved.
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,
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
SE-2840 Dr. Mark L. Hornick 1 Java Server Pages. HTML/JSPs are intended to be used as the views in an MVC- based web application Model – represents an.
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.
Chapter 5 Generating Dynamic Content. Creating a JSP Page A Sample JSP Page: easy.jsp JSP is Easy JSP is as easy as =
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
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.
CS-4220 Dr. Mark L. Hornick 1 Java Server Pages. HTML/JSPs are intended to be used as the views in an MVC- based web application Model – represents an.
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. 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.
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.
JSP – Java Server Page DBI – Representation and Management of Data on the Internet.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
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.
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.
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 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 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, !
JSP Thanks to Course-Materials/csajsp2.html.
JSP Action Elements Lec - 37.
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Developing JavaServer Pages
Java Server Pages.
Scripted Page Web App Development (Java Server Pages)
Pre-assessment Questions
Introduction to JSP Java Server Pages
Knowledge Byte In this section, you will learn about:
Chengyu Sun California State University, Los Angeles
JSP(Java Server Pages)
Invoking Java Code from JSP
Java Server Pages (JSP)
MSIS 655 Advanced Business Applications Programming
Java Server Pages.
Java Server Pages B.Ramamurthy.
JSP Directives 1-Jan-19.
COP 4610L: Applications in the Enterprise Spring 2005
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.
Presentation transcript:

JSP implicit objects & directive elements Lec - 35

JSP Journey directive elements ………………………. scripting elements JSP comments………………………………. declarations ………………………………… expressions …………………………..…….. scriptlets……………………………….......... action elements special JSP tags ………………………….…. implicit objects

Implicit Objects

Implicit Objects Objects that can be used in scriplets & expressions without defining them before. request response out Session application config pageContext exception page

Implicit Objects cont. request: javax.servlet.HttpServletRequest request object that is the reason for the servlet to run response: javax.servlet.HttpServletResponse Response for the request out: javax.servlet.jsp.JspWriter Output stream writer

Example of Implicit Objects web.jsp If page = = web index.jsp controller .jsp If page = = java java.jsp

Use of implicit objects Example Code Use of implicit objects

JSP Journey directive elements ………………………. scripting elements JSP comments………………………………. declarations ………………………………… expressions …………………………..…….. scriptlets……………………………….......... action elements special JSP tags ………………………….…. implicit objects

JSP Directives

JSP Directives Used to convey special processing information about the page to JSP container Enable programmer to: Specify page settings Include content from other resources Specify custom-tag libraries

JSP Directives cont. Format JSP directives <%@ directive {attribute=“val”}* %> JSP directives page: <%@ page {attribute=“val”}* %> include: <%@ include {attribute=“val”}* %> taglib: <%@ taglib {attribute=“val”}* %>

JSP page Directive

JSP page Directive Give high level information about servlet that will result from JSP page Can be used anywhere in the document Can control Which classes are imported What class the servlet extends What MIME type is generated How multithreading is handled If the servlet participates in session Which page handles unexpected errors

JSP page Directive cont. Defines attributes of the page <%@ page {attribute=“val”}* %> Some Attributes language = “java” extends = “package.class” import = “package.*,package.class,…” session = “true | false” Info = “text” contentType = “mimeType” isThreadSafe = “true | false” errorPage = “relativeURL” isErrorPage = “true | false” Language specifies what language Directives provide global information that is conceptually valid independent of any specific request received by the JSP page. Compile time information.

JSP page Directive cont. Some example uses are: To import the package like java.util <%@ page import = “java.util.*” info = “using util package” %> To declare this page as an error page <%@ page isErrorPage = “true” %> To generate the excel spread sheet <%@ page contentType = “application/vnd.ms-excel” %> Language specifies what language Directives provide global information that is conceptually valid independent of any specific request received by the JSP page. Compile time information.

JSP include Directive

JSP include Directive Lets you include (reuse) navigation bars, tables and other elements in JSP page You can include files at Translation Time (by using include directives) Request Time (by using Action elements)

Including Pages at Translation Time using include directive Format <%@include file=“relativeURL”%> Purpose To include a file in JSP document at the time document is translated into a servlet. May contain JSP code that affect the main page such as response header settings etc.

use of include directive Example Code use of include directive

Generate Excel Spread-sheets by setting content type Modify Last Example to Generate Excel Spread-sheets by setting content type

XML Syntax for Directives <jsp:directive.directiveType attribute=“value” /> For example, the XML equivalent of <%@ page import = “java.util.*” %> Is <jsp:directive.page import=“java.util.*” />

JSP Journey directive elements ………………………. scripting elements JSP comments………………………………. declarations ………………………………… expressions …………………………..…….. scriptlets……………………………….......... action elements special JSP tags ………………………….…. implicit objects

JSP Life Cycle Methods

JSP Life Cycle Methods jspInit() _jspService() jspDestroy() Request Response _jspService() jspDestroy()