JSP Action Elements Lec - 37.

Slides:



Advertisements
Similar presentations
Expression Language Lec Umair Javed©2006 Generating Dynamic Contents Technologies available  Servlets  JSP  JavaBeans  Custom Tags  Expression.
Advertisements

 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Chapter 91 Scopes of Variables and JavaBeans JavaServer Pages By Xue Bai.
CS320 Web and Internet Programming Java Beans and Expression Language (EL) Chengyu Sun California State University, Los Angeles.
Java Server Pages by Jon Pearce. JSP Documents JSP docs are XHTML Documents containing: –Fixed-Template Data: FTD HTML Components XML markup –JSP Components:
DT228/3 Web Development JSP: Directives and Scripting elements.
Integrating Servlets and JavaServer Pages Vijayan Sugumaran School of Business Administration Oakland University Parts of this presentation provided by.
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.
CSC 2720 Building Web Applications Using Java Beans, Custom Tags and Tag Libraries in JSP pages.
Slides © Marty Hall, book © Sun Microsystems Press 1 Including Files & Applets in JSP Documents Core Servlets & JSP book:
1 JSP – Java Server Pages Representation and Management of Data on the Internet.
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 JSP Based on: Marty Hall, Larry Brown, Core Servlets and JavaServer Pages.
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.
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 CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Slides © Marty Hall, book © Sun Microsystems Press 1 JSP Scripting Elements Core Servlets & JSP book:
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
CS320 Web and Internet Programming Java Beans and Expression Language (EL) Chengyu Sun California State University, Los Angeles.
Writing Enterprise Applications with J2EE (Fourth lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaServer Page.
Java Server Pages (JSP) Provide a cross-platform framework for creating dynamic web contents JSP Components: Static HTML/XML parts Special JSP Tags Snippets.
1 JSP – Java Server Page DBI – Representation and Management of Data on the Internet.
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.
Fall 2007cs4201 Advanced Java Programming Umar Kalim Dept. of Communication Systems Engineering
1 Processing phase Translation phase JSP page translation and processing phases Client Server Request Response Hello.jsp helloServlet.class helloServlet.java.
3/6/00jsp00 1 Java Server Pages Nancy McCracken Northeast Parallel Architectures Center at Syracuse University.
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.
Slides © Marty Hall, book © Sun Microsystems Press 1 Using JavaBeans with JSP Core Servlets & JSP book:
© 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.
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.
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 SERVER PAGES -by Rubeena Memon Deepti Jain Jaya Thakar Jisha Vettuventra.
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.
JSP Java Server Pages. Hello, !
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Introduction to Server-Side Web JavaBeans; basic concepts and syntax.
JSP Based on
Java Server Pages (JSP)
Java Server Pages By: Tejashri Udavant..
COMP9321 Web Application Engineering Semester 2, 2017
Scripted Page Web App Development (Java Server Pages)
Scope and State Handling in JSPs
Pre-assessment Questions
JavaBeans and JSP CS-422.
Introduction to Java Bean
JSP(Java Server Pages)
Java Server Pages (JSP)
Java Server Pages JSP 11/11/2018.
JSP Syntax.
Introduction to Java Server Pages
Introduction to Java Bean
Java Server Pages (JSP)
Java Server Pages B.Ramamurthy.
CS320 Web and Internet Programming Java Beans
JSP implicit objects & directive elements
Chapter-6 Java Server Page Notes
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:

JSP Action Elements Lec - 37

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

JSP Action Elements

JSP Action Elements Format Expressed using XML syntax Opening tag <jsp:actionElement attribute=“value” … > Body body Closing tag </jsp:actionElement > Empty tags without body <jsp:actionElement attribute=“value” … />

JSP Action Elements cont. Purpose To work with JavaBeans To include pages at request time To forward request to another resource etc.

Some JSP Action Elements To work with JavaBeans <jsp:useBean /> <jsp:setProperty /> <jsp:getProperty /> To include resources at request time <jsp:include /> To forward request to anther JSP or Servlet <jsp:forward /> To work with applets <jsp:plugin /> And many more….

Working with JavaBeans using JSP Action Elements

Working with JavaBeans using JSP action elements JSP action elements also helps to work with JavaBeans <jsp:useBean /> Makes a JavaBeans object available in a page <jsp:setProperty /> Sets a JavaBeans property value <jsp:getProperty /> Gets a JavaBeans property value

JSP useBean Action Element jsp:useBean is being equivalent to building an object in scriptlet <% MyBean m = new MyBean(); %> OR <jsp:useBean id = “m” scope = “page” class=“vu.MyBean ”/>

JSP setProperty Action Element jsp:setProperty is being equivalent to following code of scriptlet <% m.setName(“ali”); %> OR <jsp:setProperty id = “m” property = “name” value=“ali” />

JSP getProperty Action Element jsp:getProperty is being equivalent to following code of scriptlet <% String name = m.getName(); out.println(name); %> OR <jsp:getProperty id = “m” property= “name” />

Sharing Beans & Object Scopes

Understanding page Scope first.jsp second .jsp third.jsp request 1 request 1 or request 2 create Values not available MyBean m = new MyBean(); MyBean m m.setName(“ali”); [name = ali] Page Context

Understanding request Scope first.jsp second .jsp third.jsp fourth.jsp request 1 request 1 request 2 create values not available values available MyBean m [name = ali] ServletRequest

Understanding session Scope first.jsp second .jsp third.jsp fourth.jsp request 1 request 1 request 2 create values available values available MyBean m [name = ali] HttpSession

Understanding application Scope first.jsp second .jsp third.jsp fourth.jsp request 1 request 1 request 2 create values available values available MyBean m [name = ali] ServletContext

Different Object Scopes Most visible page Objects may be accessed only within pages where they are created Least visible

Different Object Scopes Most visible Only within pages processing the request in which they are created request page Objects may be accessed only within pages where they are created Least visible

Different Object Scopes Most visible Only from pages belonging to same session as the one in which they were created session Only within pages processing the request in which they are created request page Objects may be accessed only within pages where they are created Least visible

Different Object Scopes Within all pages belonging to same application Most visible application Only from pages belonging to same session as the one in which they were created session Only within pages processing the request in which they are created request page Objects may be accessed only within pages where they are created Least visible

Object Scopes session, request & page

Object Scopes session vs. application

More JSP Action Elements

JSP include Action Element cont. jsp:include is being equivalent to following code of scriptlet <% RequestDispatcher rd = request.getRequestDispatcher(“one.jsp”); rd.include(request, response); %> OR <jsp:include page = “one.jsp” flush= “true” />

JSP forward Action Element To forward request to another resource Format <jsp:forward page=“one.jsp" /> Works similar to following code of scriptlet <% RequestDispatcher rd = request.getRequestDispatcher(“one.jsp”); rd.forward(request, response); %> Notes -You are not permitted to specify false for the flush attribute (until JSP 1.2) -Don’t forget that trailing slash - XML syntax!