Senin, 22 Juni 2015

Pertemuan ke-12

JSTL
-> JSP Standar Tag Library
-> Library : JSTL 1.2.2
-> mudah membuat kode program dan lebih menghemat baris program
-> ex :
           <c:forEach var="i" begin="1" end="5"> item <c:out value="$(i)">  </c:forEach>       -> JSTL
           <%for(int i=0; i>=5; i++) {%>       -> JSP
                 item <%=i;%>
           <%}%>

Jenis-Jenis JSTL :
1. core(http://java.sun.com/jsp/jstl/core, prefix c) : program java biasa
2. xml processing(http://java.sun.com/jsp/jstl/xml, prefix x) : manipulasi dokumen xml
3. sql(http://java.sun.com/jsp/jstl/sql, prefix sql) : relational database
4. function(http://java.sun.com/jsp/jstl/functions, prefix fn) : manipulasi String
5. formatting(http://java.sun.com/jsp/jstl/fmt, prefix fmt) : format dan tampilan date, time, text, number

Langkah-Langkah JSTL :
1.  tambahkan file .jar dari package library
2. tag<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
3. gunakan tag lain sesuai kebutuhan

Tag lain :
* General Purpose
           inisialisasi -> <c:set var="" value="">
           print hasil -> <c:out value="$()">
           hapus yang di set -> <c:remove var="">
* Iteration
          <c:forEach var="" begin="" end=""> </c:forEach>
          <c:forToken item="" delims="" var=""> </c:forToken>
* Conditionals
          <c:choose> </c:choose>
          <c:when> </c:when>
          <c:otherwise> </c:otherwise>







Referensi :
http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm

Tidak ada komentar:

Posting Komentar