CS320 Web and Internet Programming Expression Language (EL)

Slides:



Advertisements
Similar presentations
IF statement (i) Single statement. IF ( logical expression ) statement Example: read(*,*) a if (a. lt. 0) a = -a write(*,*) a Or read(*,*) a if (a < 0)
Advertisements

© Yaron Kanza Advanced Java Server Pages Written by Dr. Yaron Kanza, Edited by permission from author by Liron Blecher.
Expression Language Lec Umair Javed©2006 Generating Dynamic Contents Technologies available  Servlets  JSP  JavaBeans  Custom Tags  Expression.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
CS320 Web and Internet Programming Java Beans and Expression Language (EL) Chengyu Sun California State University, Los Angeles.
DT211/3 Internet Application Development
CS320 Web and Internet Programming JSP Scripting Elements and Page Directives Chengyu Sun California State University, Los Angeles.
Faculty of Information Technology © Copyright UTS Faculty of Information Technology 2008 – JSPJSP /32549 Advanced Internet Programming Java Server.
10. JEL 과 JSTL 10-1 EL 소개 10-2 JSTL 소개 10-3 코어 라이브러리 10-4 I18N 라이브러리 10-5 SQL 라이브러리 10-6 XML 라이브러리.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
Intermediate JSP Matt Wheeler. Notes This is a training NOT a presentation If you have questions please ask them Prerequisites – Introduction to Java.
CSC 2720 Building Web Applications Using Java Beans, Custom Tags and Tag Libraries in JSP pages.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
Organization of the platform Your application Java language Java Servlet API JavaServer Pages (JSP) JSTL Your web pages.
Middleware Technology JavaServer Pages (JSP)
® IBM Software Group © 2007 IBM Corporation JSP Expression Language
16-Oct-15 JSP Implicit Objects. 2 JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer.
EXPRESSION LANGUAGE Msc : Lê Gia Minh. EL Language : Cơ Bản  Cho phép JSP developers truy cập các đối tượng Java thông qua tag. Được dùng hiển thị nội.
JSTL: The JavaServer Pages Standard Tag Library Mark A. Kolb Security Broadband, Austin, TX
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.
Perl Practical(?)‏ Extraction and Report Language.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
CSC 2720 Building Web Applications JavaServer Pages (JSP) The Basics.
COMP 321 Week 10. Overview Using Beans in JSP Expression Language JSTL Lab 10-1 Introduction Exam Review.
JSP Expression Language (EL) 25-Nov-15. JSP - E XPRESSION L ANGUAGE (EL) Introduction Expression Language was first introduced in JSTL 1.0 (JSP Standard.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Fall 2007cs4201 Advanced Java Programming Umar Kalim Dept. of Communication Systems Engineering
EL and JSTL. JSTL Sources
Slides © Marty Hall, book © Sun Microsystems Press 1 Using JavaBeans with JSP Core Servlets & JSP book:
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
Shell script – part 2 CS 302. Special shell variable $0.. $9  Positional parameters or command line arguments  For example, a script myscript take 2.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Intermediate JSP Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic Java.
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.
CS320 Web and Internet Programming Web Application and MVC Chengyu Sun California State University, Los Angeles.
JSP Action Elements Lec - 37.
JSP Elements Chapter 2.
The Expression Language Syntax
CS520 Web Programming Servlet and JSP Review
JSP: Actions elements and JSTL
CS5220 Advanced Topics in Web Programming JavaScript and jQuery
Java Server Pages By: Tejashri Udavant..
CS520 Web Programming Servlet and JSP Review
Chengyu Sun California State University, Los Angeles
OPERATORS (2) CSC 111.
Control Structures: if Conditional
JSP Standard Tag Library
CS320 Web and Internet Programming Cookies and Session Tracking
Control Structures: for & while Loops
CS320 Web and Internet Programming Java Beans
CS320 Web and Internet Programming MVC Architecture
CS5220 Advanced Topics in Web Programming JavaScript Basics
CS2011 Introduction to Programming I Loop Statements (II)
CS2011 Introduction to Programming I Arrays (I)
CS3220 Web and Internet Programming JavaScript Basics
CS3220 Web and Internet Programming Expression Language (EL)
CS2011 Introduction to Programming I Selections (I)
CS3220 Web and Internet Programming Cookies and Session Tracking
CS3220 Web and Internet Programming Expression Language (EL)
The Selection Structure
CS3220 Web and Internet Programming About Data Models
CS3220 Web and Internet Programming JavaScript Basics
INTRODUCTION to PERL PART 1.
Chengyu Sun California State University, Los Angeles
Presentation transcript:

CS320 Web and Internet Programming Expression Language (EL) Chengyu Sun California State University, Los Angeles

What is EL? Expression Language (EL) Syntax: ${ expression } Since the JSP 2.0 Specification A more concise way to access bean properties and write JSP expressions vs. <jsp:getProperty> vs. <%= expression %> Java’s answer to scripting languages Syntax: ${ expression }

Example: BGColor.jsp Revisited Use EL to access the bean properties ${ bean_name.property_name }

More Property Access Examples Bean BeanA int property id String property name String[] property weekdays List<Integer> property numbers Bean BeanB BeanA property bean0 List<BeanA> property beans

Expression Literals Operators Variables

EL Literals true, false 23, 0x10, ... 7.5, 1.1e13, ... “double-quoted”, ‘single-quoted’ null No char type

EL Operators Conditional empty Other Arithmetic ? : Logical +, -, *, /, % div, mod Logical &&, ||, ! and, or, not Relational ==, !=, <, >, <=, >= eq, ne, lt, gt, le, ge Conditional ? : empty check whether a value is null or empty Other [], ., ()

EL Evaluation and Auto Type Conversion ${2+4/2} ${2+3/2} ${“2”+3/2} ${“2”+3 div 2} ${“a” + 3 div 2} ${null == ‘test’} ${null eq ‘null’} ${empty “”} ${empty null} ${empty “null”} ${“abc” lt ‘b’} ${“cs320” > “cs203”}

EL Variables You cannot declare new variables using EL (after all, it’s called “expression” language). However, you can access beans, implicit objects, and previously defined scoped variables (i.e. the objects saved in application/session/request/page scopes by setAttribute())

Implicit Objects in EL pageScope requestScope sessionScope pageContext servletContext session request response param, paramValues header,headerValues cookie initParam pageScope requestScope sessionScope applicationScope

Example: RequestInfo.jsp Display some information about the request Client address … Cookies and parameters Use of implicit objects Find the Java class type for the object Look for getters in the API E.g. ${pageContext.request.remoteAddr} Access elements in a collection cookie and param

Limitation of EL Only expressions, no statements, especially no control-flow statements JSTL