25
Chapter 9 JSP Standard Tag Library (JSTL) Templates (EL)

Ch. 9 jsp standard tag library

Embed Size (px)

Citation preview

Page 1: Ch. 9 jsp standard tag library

Chapter 9JSP Standard Tag Library (JSTL)

Templates (EL)

Page 2: Ch. 9 jsp standard tag library

EL and standard actions not enough

• Looping

• Flow control

• …

• Install (see page 440 in the book)

Page 3: Ch. 9 jsp standard tag library

• http://cs.roosevelt.edu/eric/books/JSP/jstl-quick-reference.pdf

• JSTL 2.1

Page 4: Ch. 9 jsp standard tag library

the <c:out> tag

• May have attributes too <b>Hello <c:out value=’${user}’ default=’guest’ />.</b>

• May save you from cross-site hacking

Page 5: Ch. 9 jsp standard tag library

Looping without scripting

Servlet code

JSP with scripting

Page 6: Ch. 9 jsp standard tag library

<c:forEach> anatomy

Page 7: Ch. 9 jsp standard tag library

Optional variables

Page 8: Ch. 9 jsp standard tag library

Nesting the loops

Page 9: Ch. 9 jsp standard tag library

<c:if>

Page 10: Ch. 9 jsp standard tag library

<c:choose>, <c:when> & <c:otherwise>

Page 11: Ch. 9 jsp standard tag library

<c:set>

attribute value

target property

<jsp:setProperty>

Page 12: Ch. 9 jsp standard tag library

<c:remove> & <c:import>

include directive or <jsp:include> SA can not do this and many more others

Page 13: Ch. 9 jsp standard tag library

<c:url>

Page 14: Ch. 9 jsp standard tag library

<c:catch>

(in DD also)

Page 15: Ch. 9 jsp standard tag library

Not all errors are catchable

Page 16: Ch. 9 jsp standard tag library
Page 17: Ch. 9 jsp standard tag library

Custom Libraries

• tag name and syntax

• library URI

• TLD (Tag Library Descriptor)

Page 18: Ch. 9 jsp standard tag library

DD  helps

Page 19: Ch. 9 jsp standard tag library

Catch  them  all?

Page 20: Ch. 9 jsp standard tag library

Using  custom  tags:

 the  Tag  Library  Descriptor  (TLD)

Page 21: Ch. 9 jsp standard tag library

Using  custom  tags

Page 22: Ch. 9 jsp standard tag library

Handling  a  custom  tag

Page 23: Ch. 9 jsp standard tag library

<rtexprvalue>  

Page 24: Ch. 9 jsp standard tag library

How  do  they  

match?

Page 25: Ch. 9 jsp standard tag library

Where  are  the  tld’s?