JSP Tag Library - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

JSP Tag Library

Description:

JSP Tag Library CSCI 4300 Notes from Steve Small, http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl.html What is the Tag library? Creates additional XML ... – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 6
Provided by: DanEv9
Learn more at: http://cobweb.cs.uga.edu
Category:
Tags: jsp | functions | library | tag

less

Transcript and Presenter's Notes

Title: JSP Tag Library


1
JSP Tag Library
  • CSCI 4300
  • Notes from Steve Small,
  • http//www.javaworld.com/javaworld/jw-02-2003/jw-0
    228-jstl.html

2
What is the Tag library?
  • Creates additional XML-style tags
  • Provide programming functionality with (somewhat)
    less mess
  • Standard tag library
  • Core functions (output, control statements)
  • Formatting
  • Internationalization
  • SQL

3
Installing the standard library
  • Download and install JSTL support in Tomcat
  • Declare in web.xml
  • lttaglibgt    lttaglib-urigthttp//java.sun.com/jstl/
    corelt/taglib-urigt    lttaglib-locationgt/WEB-INF/c.
    tldlt/taglib-locationgt  lt/taglibgt
  • Include taglib descriptor file c.tld in WEB-INF
  • lt_at_ taglib uri"http//java.sun.com/jstl/core"
    prefix"c" gt

4
Core STL Example
  • ltbgtParameter values passed to this page for each
    parameter lt/bgt
  • lttable border"2"gtltcforEach var"current"
    items"param"gt    lttrgt    lttdgt    ltbgtltcout
    value"current.key" /gtlt/bgt    lt/tdgt        ltc
    forEach var"aVal" items"paramValuescurrent.k
    ey"gt            lttdgt            ltcout
    value"aVal" /gt            lt/tdgt        lt/cf
    orEachgt    lt/trgtlt/cforEachgtlt/tablegt
  • Param and paramValues are global Map vars from
    Web container

5
JSP Expression Language
  • Similar to PHP or Perl string interpolation
  • variable-name value of that variable
  • ltcout value"anExpression"/gtltcout
    value"literalTextanExpressionanotherExpressi
    on"/gtltcout value"literalText"/gt
  • anObject.aPropertyanObject"aPropertyName"
    anObjectaVariableContainingPropertyName
Write a Comment
User Comments (0)
About PowerShow.com