JSTL and Web Development at Universities Shawn Bayern Research programmer, Yale University JSTL reference-implementation lead Author, Web Development with.

Slides:



Advertisements
Similar presentations
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
Advertisements

8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Apache Struts Technology
Expression Language Lec Umair Javed©2006 Generating Dynamic Contents Technologies available  Servlets  JSP  JavaBeans  Custom Tags  Expression.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
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.
DT211/3 Internet Application Development
JSP 2.0 and JSTL: Principles and Patterns Shawn Bayern Research Programmer, Yale University JSTL reference-implementation lead Author, JSTL in Action Web.
DT228/3 Web Development JSP: Directives and Scripting elements.
Apache Struts Technology A MVC Framework for Java Web Applications.
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.
JavaServer Pages TM Introduce by
Introduction to Java web programming Dr Jim Briggs JWP intro1.
DSpace XML UI Project Texas A&M University Digital Initiatives, Research and Technology Scott Phillips, Cody Green, Alexey Maslov, Adam Mikeal, Brian Surratt,
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.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
JSP Standard Tag Library
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.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
Introduction to Java Server Pages (JSPs) Robert Thornton.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
Using JSP 2.0’s New Features Shawn Bayern Research Programmer, Yale University JSTL reference-implementation lead Author, JSTL in Action Web Development.
Organization of the platform Your application Java language Java Servlet API JavaServer Pages (JSP) JSTL Your web pages.
® IBM Software Group © 2007 IBM Corporation JSP Expression Language
JSTL JSP Standard Tag Library 12-Oct-15. W HAT IS JSTL? JSTL (JSP Standard Tag Libraries) is a collection of JSP custom tags developed by Java Community.
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.
Fall CIS 764 Database Systems Design L8. Web ….
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.
Fall 2007cs4201 Advanced Java Programming Umar Kalim Dept. of Communication Systems Engineering
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 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.
JSTL The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
3/6/00jsp00 1 Java Server Pages Nancy McCracken Northeast Parallel Architectures Center at Syracuse University.
OOSSE Week 8 JSP models Format of lecture: Assignment context JSP models JSPs calling other JSPs i.e. breaking up work Parameter passing JSPs with Add.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© 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.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
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.
 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.
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 ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Introducing the Central Authentication Service (CAS) Shawn Bayern Research programmer, ITS Technology & Planning Author, Web Development with JavaServer.
Apache Struts Technology A MVC Framework for Java Web Applications.
Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Web browser Web server HTML request Scripted pagedatabase The following components will be used: Apache Jakarta Tomcat servlet engine Derby JavaServer.
JSP: Actions elements and JSTL
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.
Java Servlets.
Knowledge Byte In this section, you will learn about:
MSIS 655 Advanced Business Applications Programming
JSP Standard Tag Library
JSP 2.0 and JSTL: Principles and Patterns
JavaServer Faces: The Fundamentals
Presentation transcript:

JSTL and Web Development at Universities Shawn Bayern Research programmer, Yale University JSTL reference-implementation lead Author, Web Development with JavaServer Pages Author, The JSP Standard Tag Library (upcoming)

Agenda JSP overview: scripting and tag libraries JSTL basics Origins Design Features Examples of design principles in use Yale’s network-registration application HTML “scraping” for portals Q&A

JavaServer Pages Scriptlets <% getFoo(request); printFoo(out); String a = “goat”; %> Oink! Java (and more?) embedded within template text Access to implicit objects: request, response, etc. Conditional blocks, loops—manually constructed

JavaServer Pages Tag libraries c is true Round and round we go HTML-like tags (can be well-formed XML) Invoke Java logic behind the scenes. May access body, e.g., for iteration, conditional exclusion—or just as arbitrary parameter May access PageContext Libraries and prefixes

Advantages of tag libraries Abstraction, abstraction, abstraction. Abstraction. Separation of logic from presentation and content. Simple, familiar interface for page authors. Implicit (versus explicit) arguments.

Tag library Tags: Abstracting logic JSP page Back-end Java code Database Directory Tag library

What is a JSP tag? “Standard actions” – e.g., Part of JSP spec Java class implementing Tag interface Accepts attributes as JavaBean properties ( setXXX() ) Answers callbacks associated with Start of tag End of body End of tag … and so on Why so specific? (No closure for body.) Knows about its page (PageContext) Knows about its parent tags findAncestorWithClass() Optionally knows about its body (BodyContent)

Tag handler doStartTag()doEndTag() doCatch()doFinally() Tag attributes Tag body

Where do tag libraries come from? Java developers like us To support ourselves, our page authors Vendors—e.g., Allaire, BEA, iPlanet Standard tag library Java Community Process (JSR-052) Input from familiar vendors, motivated individuals Under Sun’s leadership Implementation distributed through Apache

JSTL design principles JSTL 1.0: Keep it simple! Targeted tags Could have a single tag: Instead, single-purpose tags, tightly focused Design motivated by “page author” Perhaps something of a fantasy, like the legal “reasonable person.” But a helpful guide nonetheless.

The parable of Mike and Phillipe Mike Phillipe Credit: Pierre Delisle (spec lead)

Potential limitations Tag abstraction may be excessive for tiny applications (but JSP 1.3…) Page authors need technical skills! They must understand: Flow of application Programmatic control flow within page Variable reference (expression language) Domain-specific languages (SQL, XPath) and associated principles

JSTL 1.0 features Conditional logic Iteration Text retrieval (URL, RequestDispatcher ) Text formatting and parsing (i18n) XML manipulation (XPath, XSLT) Database access Last but certainly not least: Expression language

JSTL 1.0 libraries Library featuresRecommended prefix Core (control flow, URLs, variable access) c Text formattingfmt XML manipulationx Database accesssql

JSTL features: expression language JSTL’s major structural innovation Replaces “rtexprvalues” Allows simple retrieval of scoped attributes… $session:duck … and other data $cookie:crumb $param:

JSP history: progress Scriptlets Beans and standard actions Traditional tag libraries ’/> Expression-language capable library rtexprvalu e

State of expression language Syntax currently being debated EA2 supports “pluggable” languages for experimentation. Candidates include: SPEL (straw man) ECMAScript JXPath Comments?

Advantages of expression language Scripting, not programming. Not even scripting, really.  Having said that, I personally hope that the EL(s) we  standardize on are so simple as to require almost no  education at all. +2 Typeless reference Simplified syntax

JSTL features: core tags (1) Iteration <c:forEach items=“$list” begin=“5” end=“20” step=“4” var=“item”> “var” convention and variable access “paging”

JSTL features: core tags (2) Conditional evaluation a equals b Mutually exclusive conditionals a equals b a equals c I don’t know what ‘a’equals.

JSTL features: core tags (3) URL retrieval <c:import var=“cnn” url=“ ”/> Data exposed as String or Reader All core URLs supported (HTTP, FTP, HTTPS with JSSE) Local, cross-context imports supported

JSTL features: text formatting Formatting and parsing Numbers Dates Internationalization Message bundles Locale support Message argument substitution “Hi {0}. I would like to {1} your money today. I will use it to buy myself a big {2}.”

JSTL features: XML manipulation Use of XSLT, XPath to access, display pieces of XML documents Example later

JSTL features: database manipulation Tags for Queries ResultSet caching Updates / inserts Transactions Parametric ( PreparedStatement ) argument substitution DataSource-based connection management

SQL tags: the debate Tag library JSP page Back-end Java code Database Tag library

JSTL programmer support JSTL also supports Java developers Simplifies tag development IteratorTagSupport, ConditionalTagSupport Instead of writing whole tag handler ( doStartTag(), doEndTag() ), simply override a few methods: protected boolean condition() protected Object next()

JSTL schedule Currently in Early Access Release 2 No promises, but many hints. → “Standard” EA3 mid December Release of 1.0 in 2002 JSTL 1.0 to include core features Later versions fill in other convenient but less general functionality. Perhaps more J2EE-specific support. Applies to this presentation too!

JSP/JSTL future Finalize JSTL JSP 1.3 Universalize “expression language” Support creation of tags in JSP itself Works nicely with JSTL’s focused tags Books, educational materials on JSTL to assist page authors (and us developers vicariously).

Yale example: Netreg Student network registration (Netreg) application Used by 5900 students to register computers for network use Discovers EA via SNMP router query Managed by Student Computing group at Yale; my group provided support Developed in less than a month Student Computing group (nonprogrammers) maintains user interface

Yale example: Netreg HTML, JSP code produced and maintained by nonprogrammers Application uses early-access “standard” – plus locally written – tags.

Yale example: Netreg Example code Retrieve full name from database <reg:fullName var="name“ netid=“$netid"/> Conduct CAS authentication Discover Ethernet address

Yale example: Netreg Custom “registration” tags documented, available to page authors. Via attributes, the data these tags expose is accessible to JSTL tags.

Yale example: XML/XPath Portals, other “summary” web sites often need to retrieve content from other pages. JSTL provides a flexible, standard way to handle this task. Example: retrieve headlines from student newspaper, display in custom format.

Yale example: XML/XPath <x:expr Sample XML: … Headline …

Advantages of JSTL XML/XPath support Why not always use XSLT? JSTL provides XPath support but doesn’t preclude convenient, standard access to Java/JSP code. E.g., parse an article URL out of a document, then follow the URL and parse its contents. JSP/JSTL may be more familiar and convenient for simple tasks.

Summary JSP supports scriptlets (poor abstraction) and tags (useful abstraction) JSTL is the JSP Standard Tag Library. JSTL and JSP tags support separation of content from presentation

URLs Jakarta Taglibs JSTL JSR JSP 1.3 JSR Official address for JSTL comments My upcoming JSTL book’s site My address