charvaku's picture
From charvaku rss RSS  subscribe Subscribe

JSP Standart Tag Lİbrary - JSTL 

JSP Standart Tag Lİbrary - JSTL

 

 
 
Tags:  tag 
Views:  3278
Published:  December 30, 2009
 
0
download

Share plick with friends Share
save to favorite
Report Abuse Report Abuse
 
Related Plicks
14k Gold Diamond Dog Tags

14k Gold Diamond Dog Tags

From: ubermann101
Views: 1414 Comments: 0
www.dogtagsevolved.com 14k gold diamond dog tags,jewelry dog tags,dog tag necklaces,silver dog tags. Where to find the best.
 
WC Tag Collection

WC Tag Collection

From: lvgangqiang
Views: 3199 Comments: 0

 
Team Tag Scam and Team Tag Review 1

Team Tag Scam and Team Tag Review 1

From: brandon1
Views: 39 Comments: 0
In traditional wrestling wrestlers hit other with prompts which is very dangerous. Team tag reviews is different from this traditional wrestling because it is a scam and team tag scam never be done.
 
See all 
 
More from this user
Unit 4 1 Public Opinion And Political Socialization

Unit 4 1 Public Opinion And Political Socialization

From: charvaku
Views: 992
Comments: 0

EMC VisualSAN INFOBrief (Microsoft Word format)

EMC VisualSAN INFOBrief (Microsoft Word format)

From: charvaku
Views: 116
Comments: 0

Hosted Crm Comparison Guide

Hosted Crm Comparison Guide

From: charvaku
Views: 242
Comments: 0

Imrb Iamai Mobile Vas Report August 2008

Imrb Iamai Mobile Vas Report August 2008

From: charvaku
Views: 312
Comments: 0

Why ROI matters online

Why ROI matters online

From: charvaku
Views: 165
Comments: 0

 
See all 
 
 
 URL:          AddThis Social Bookmark Button
Embed Thin Player: (fits in most blogs)
Embed Full Player :
 
 

Name

Email (will NOT be shown to other users)

 

 
 
Comments: (watch)
 
 
Notes:
 
Slide 1: JSP Standart Tag Library-JSTL Gökhan Tanışık gokhantanisik@hotmail.com 15.07.2008
Slide 2: Session Objectives  This session is learning about the jstl:  What jstl is  Why do we use it  Tag libraries included in jstl  A detailed glance to the jstl-core library  The other libraries and their functions  How to use the jstl in a project
Slide 3: Agenda  What JSTL is?  What JSTL Offers?  JSTL Tag Libraries            How to use JSTL General Purpose Actions Conditional Actions Iterator Actions URL relative Actions I18N actions Formatting Actions SQL Actions XML core Actions XML Flow Control Actions XML Transform Actions
Slide 4: What JSTL is?  JSTL (JSP Standard Tag Libraries) is a collection of JSP custom tags developed by Java Community Process, www.jcp.org.  The goal of JSTL is to help simplify JavaServer Pages page authors' lives. To achieve this goal, JSTL has provided custom tags for many common JSP page authoring tasks that require scripting statements to manipulate server side dynamic data.
Slide 5: What JSTL offers?  General-purpose actions: Displaying, scope, setting and removing jsp scoped attributes, catching exceptions.  Control flow actions: Conditional, iterators…  Tag library validators: TLVs allow projects to only allow specific tag libraries, as well as enforce JSP coding styles that are free of scripting elements
Slide 6: What JSTL offers? (2)  The other key aspects of JSTL are: ■ Accessing URL-based resources ■ Internationalization (i18n) and text formatting ■ Relational database access (SQL) ■ XML processing ■ String manipulation
Slide 7: JSTL Tag Libraries Functional Area Core Xml Processing I18N capable formatting Relational database accesing (SQL) Functions URI http://java.sun.com/jsp/jstl/core http://java.sun.com/jsp/jstl/xml http://java.sun.com/jsp/jstl/fmt http://java.sun.com/jsp/jstl/sql http://java.sun.com/jsp/jstl/functions Prefix c x fmt sql fn
Slide 8: General Purpose Actions  Uri=http://java.sun.com/jsp/jstl/core , prefix=c  <c:set>      Set the value of a scoped variable using attribute value <c:set value=”value” var=”varName” [scope=”{page|request| session|application}”]/> Set the value of a scoped variable using body content <c:set var=”varName” [scope=”{page|request|…}”]> body content </c:set> Set a property of a target object using attribute value <c:set value=”value” target=”target” property=”propertyName”/> Set a property of a target object using body content <c:set target=”target” property=”propertyName”> body content </c:set> Set a deferred value <c:set var=”varName” value="deferred-value"/>
Slide 9: General Purpose Actions (2)  <c:remove>   <c:catch>  The natural companion to <c:set>, allowing the explicit removal of scoped variables <c:remove var="cachedResult“ scope="application"/> provides a complement to the JSP error page mechanism <c:catch var=”exception”> <!-- Execution we can recover from if exception occurs --> ... </c:catch> <c:if test=”${exception != null}”> Sorry. Processing could not be performed because... </c:if>
Slide 10: General Purpose Actions (3)  <c:out>  Without a body <c:out value=”value” escapeXml=”{true| false}”] [default=”defaultValue”] />  With a body (jsp body) <c:out value=”value” [escapeXml=”{true| false}”]> default value </c:out>
Slide 11: Conditional Actions  <c:if>  Without body content <c:if test=”testCondition” var=”varName” [scope=”{page|request| …}”]/>  With body content (jsp body) <c:if test=”testCondition” [var=”varName”] [scope=”{page| request|…}”]> body content </c:if>
Slide 12: Conditional Actions(2)  <c:choose> <c:choose> body content (<when> and <otherwise> subtags) </c:choose>  The body of the <c:choose> action can only contain: ■ White spaces May appear anywhere around the <c:when> and <c:otherwise> subtags. ■ 1 or more <c:when> actions Must all appear before <c:otherwise> ■ 0 or 1 <c:otherwise> action
Slide 13: Conditional Actions(3)  <c:when>  Represents an alternative within a <c:choose> action. <c:when test=”testCondition”> body content </c:when> ■ Must have <c:choose> as an immediate parent. ■ Must appear before an <c:otherwise> action that has the same parent.
Slide 14: Conditional Actions(4)  <c:otherwise>  Represents the last alternative within a <c:choose> action. <c:otherwise> conditional block </c:otherwise> ■ Must have <c:choose> as an immediate parent. ■ Must be the last nested action within <c:choose>.
Slide 15: Iterator Actions  <forEach>  Iterate over a collection of objects <c:forEach[var=”varName”] items=”collection” [varStatus=”varStatusName”] [begin=”begin”] [end=”end”] [step=”step”]> body content </c:forEach>  Iterate a fixed number of times <c:forEach [var=”varName”] [varStatus=”varStatusName”] begin=”begin” end=”end” [step=”step”]>
Slide 16: Iterator Actions (1)  Example 1 – iteration of a collection (Arraylist /vector/…) <table> <c:forEach var=”product” items=”${products}” varStatus=”status”> <tr><td>${status.count}”</td> <td>${product.name}”</td></tr> </c:forEach> </table>  Example 2 – iteration of a has map <c:forEach var="entry" items="${myHashtable}"> Next element is ${entry.value} </c:forEach>
Slide 17: Iterator Actions(2)  <c:forTokens>  Iterates over tokens, separated by the supplied delimiters. <c:forTokens items="stringOfTokens“ delims="delimiters“ [var="varName"] [varStatus="varStatusName"] [begin="begin"] [end="end"] [step="step"]> body content </c:forTokens>
Slide 18: URL Related Actions  URL  import a resource with an absolute URL <c:import url=”http://acme.com/exec/customers? country=Japan”/>  import a resource with a relative URL - same context import a resource with a relative URL - foreign context <c:import url=”/copyright.html”/>  <c:import url=”/logo.html” context=”/master”/>
Slide 19: URL Related Actions(2) Exporting the content of the url Export the content of the URL resource as a String <c:import var="customers" url=”http://acme.com/ exec/customers?country=USA"/>  Export the content of the URL resource as a Reader <c:import varReader="customers" url=”http://acme.com/exec/customers?country=USA">  Body content </c:import>
Slide 20: URL Related Actions(3)  <import>    Imports the content of a URL- based resource: Resource content inlined or exported as a String object <c:import url=”url” [context=”context”] [var=”varName”] [scope=”{page|request|…}”] [charEncoding=”charEncoding”]> optional body content for <c:param> subtags </c:import> Resource content exported as a Reader object <c:import url=”url” [context=”context”] varReader=”varReaderName” [charEncoding=”charEncoding”]> body content where varReader is consumed by another action </c:import>
Slide 21: URL Related Actions(4)  <c:url>   Builds a URL with the proper rewriting rules applied. Without body content <c:url value=”value” [context=”context”] [var=”varName”] [scope=”{page|request|…}”]/ >  With body content to specify query string parameters <c:url value=”value” [context=”context”] [var=”varName”] [scope=”{page|request|…}”]> <c:param> subtags </c:url>
Slide 22: URL Related Actions(5)  <redirect>  Sends an HTTP redirect to the client.  Without body content <c:redirect url=”value” [context=”context”]/>  With body content to specify query string parameters <c:redirect url=”value” [context=”context”]> <c:param> subtags </c:redirect>
Slide 23: URL Related Actions(6)  <c:param>  Adds request parameters to a URL. Nested action of <c:import>, <c:url>,<c:redirect>.  Parameter value specified in attribute “value” <c:param name=”name” value=”value”/>  Parameter value specified in the body content <c:param name=”name”> parameter value </c:param>
Slide 24: Internationalization(i18n) Actions  URI: http://java.sun.com/jsp/jstl/fmt ,prefix=“fmt”  <fmt:setLocale>  <fmt:bundle>  <fmt:setBundle>  <fmt:message>  <fmt:param>  <fmt:requestEncoding>
Slide 25: Formatting Actions  URI: http://java.sun.com/jsp/jstl/fmt ,prefix=“fmt”  <fmt:timeZone>  <fmt:setTimeZone>  <fmt:formatNumber>  <fmt:parseNumber>  <fmt:formatDate>  <fmt:parseDate>
Slide 26: SQL Actions  URI: http://java.sun.com/jsp/jstl/sql, prefix=“sql”  <sql:query>  <sql:update>  <sql:transaction>  <sql:setDataSource>  <sql:param>  <sql:dateParam>
Slide 27: XML Core Actions  URI: http://java.sun.com/jsp/jstl/xml, prefix=“x”  <x:parse>  <x:out>  <x:set>
Slide 28: XML Flow Control Actions  URI: http://java.sun.com/jsp/jstl/xml, prefix=“x”  <x:if>  <x:choose>  <x:when>  <x:otherwise>  <x:forEach>
Slide 29: XML Transform Actions  URI: http://java.sun.com/jsp/jstl/xml, prefix=“x”  <x:transform>  <x:param>
Slide 30: Functions Tag Library  URI: http://java.sun.com/jsp/jstl/functions, prefix=“x”  <fn:contains>  <fn:containsIgnoreCase>  <fn:endsWith>  <fn:escapeXml>  <fn:indexOf>  <fn:join>  <fn:length>  <fn:replace>
Slide 31: Functions Tag Library(2)  <fn:split>  <fn:startsWith>  <fn:substring>  <fn:substringAfter>  <fn:substringBefore>  <fn:toLoweCase>  <fn:toUpperCase>  <fn:trim>
Slide 32: How to use JSTL in a project  Download the lates version of jst from  http://www.apache.org/dist/jakarta/taglibs/standard/binaries/  Open the archive and, copy the jstl.jar and standart.jar files     under the lib folder to the /WEB-INF/lib folder of your project Define the taglib in jsp as: <%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%> If the code above doesn’t works, use below <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
Slide 33: Thanks…

   
Time on Slide Time on Plick
Slides per Visit Slide Views Views by Location