JSP Standard Tag Library Part 2-Java Programming-Lecture Slides, Slides of Java Programming

This is an Introductory course of Java Web Programming focusing on writing maintainable extensible code, methods of debugging, logging and profiling. The Java Technology used is J2EE an Enterprise Application Development tool. This lecture includes: Iterator, Tag, Collection, Items, HTTP, Redirect, Parameter, Cookie, JSP, Token

Typology: Slides

2011/2012

Uploaded on 08/09/2012

dhanyaa
dhanyaa 🇮🇳

4.7

(3)

60 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Iterator Tag: <c:forEach>
Allows you to iterate over a collection of objects
items: represent the collection of objects
var: current item
varStatus: iteration status
begin, end, step: range and interval
Collection types
java.util.Collection
java.util.Map
value of var attribute should be of type java.util.Map.Entry
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download JSP Standard Tag Library Part 2-Java Programming-Lecture Slides and more Slides Java Programming in PDF only on Docsity!

Iterator Tag: <c:forEach>

 Allows you to iterate over a collection of objects

 items: represent the collection of objects

 var: current item

 varStatus: iteration status

 begin, end, step: range and interval

 Collection types

 java.util.Collection

 java.util.Map

 value of var attribute should be of type java.util.Map.Entry

Example: <c:forEach>

quoted from ./iterators/Simple.jsp

<c:forEach var="customer" items="${customers}"> ${customer}
</c:forEach>

Example: <c:forEach>, Data types

quoted from ./iterators/DataTypes.jsp

<c:forEach var="i" items="${intArray}"> <c:out value="${i}"/> • </c:forEach> <c:forEach var="string" items="${stringArray}"> <c:out value="${string}"/>
</c:forEach> <c:forEach var="item" items="${enumeration}" begin=" 2 " end=" 10 " step=" 2 "> <c:out value="${item}"/>
</c:forEach> <c:forEach var="prop" items="${numberMap}" begin=" 1 " end=" 5 "> <c:out value="${prop.key}"/> = <c:out value="${prop.value}"/>
</c:forEach> <c:forEach var="token" items="bleu,blanc,rouge"> <c:out value="${token}"/>
</c:forEach>

Example: <c:forEach>, Data types

quoted from ./iterators/DataTypes.jsp

Example: <c:forEach>, Iteration status

quoted from ./iterators/Status.jsp

Example: <c:forToken>

<c:forTokens var="token" items="one,two,three" delims=","> <c:out value="${token}"/> </c:forTokens>

Example: <c:out>

quoted from /elsupport/Out.jsp

URL Import: <c:import>

 More generic way to access URL-based resources

(than <jsp:include>)

 Absolute URL: for accessing resources outside of Web

application

 Relative URL: for accessing resources inside of the same

Web application

 More efficient (than <jsp:include>)

 No buffering

 <c:param> tag can be used to specify parameters (like

<jsp:param>)

Example: <c:import> with <c:param>

<c:import url="header.jsp"> <c:param name="pageTitle" value="newInstance.com"/> <c:param name="pageSlogan" value=" " /> </c:import>

URL Rewriting: <c:url>

 Used for URL rewriting

 All the URL's that are returned from a JSP page (to a

browser) have session ID if Cookie is disabled on the

browser

 Can take param subtags for including parameters in

the returned URL

Example: <c:url> - Cookie enabled

quoted from /import/Encode.jsp

Example: <c:url> - Cookie disabled