SlideShare a Scribd company logo
Core JSTL

    Cornelius Koo, ST
       JavaSchool
          2005
Jl. Cemara 2/20, Salatiga
Copy The Libraries
Basic JSTL
Don’t Forget The Taglib
<%@ taglib prefix="c"
 uri="http://java.sun.com/jsp/jstl/core" %>
<c:out>
<c:out value='Hello World'/>




                               out.jsp
<c:forEach>
<table>
  <c:forEach var="movie"
              items="${movieList}"
              varStatus="movieLoopCount">
      <tr>
            <td>${movieLoopCount.count}</td>
            <td>${movie}</td>
      </tr>
  </c:forEach>
</table>
                                     forEach.jsp
<c:if>
<c:if test="${param.user eq 'Member'}">
  <jsp:include page="inputComments.jsp"
  flush="true"/>
</c:if>
<c:if test="${param.user eq 'Non-Member'}">
  <jsp:include page="suggestion.jsp"flush="true"/>
</c:if>
<c:if test="${empty param.user}">
  <c:out value='Give your choice...'/>
</c:if>                                if.jsp
<c:choose>, <c:when>,
    <c:otherwise>
<c:choose>
   <c:when test="${param.level == 'insane'}">
        All enemy heroes are 200% stronger
   </c:when>
   <c:when test="${param.level == 'normal'}">
        All enemy heroes are have the same power level compared to
   yours
   </c:when>
   <c:when test="${param.level == 'easy'}">
        Your hero will be the strongest
   </c:when>
   <c:otherwise>
        You have to choose your game level
   </c:otherwise>
</c:choose>

                                                      choose.jsp
<c:set>
var for Attribute
<c:set var="level" scope="session"
  value="insane"/>
Level: ${level}

<c:set var="player" scope="session">
  Zaradaz
</c:set>
<br/>
Players : ${player}
                                       set-var.jsp
target for Map
<jsp:useBean id="person" class="jsp.example.bean.Employee"/>
<jsp:setProperty name="person" property="name"
   value="John"/>

<c:set target="${person}" property="address" value="Dipo 64"/>
<c:set target="${person}" property="age">
   55
</c:set>
<br/>
Name : ${person.name}
<br/>
Address : ${person.address}
<br/>
Age : ${person.age}
                                                 set-target.jsp
<c:remove>
<c:set var="level" scope="session"
  value="insane"/>
Level: ${level}

<c:set var="player" scope="session">
  Zaradaz
</c:set>
<br/>
Players : ${player}
<c:remove var="player" scope="session"/>
<br/>
Players is now : ${player}           set-var.jsp
<c:import>
• It can be use to include static page from
  outside the web-container.
<c:import
   url=“http://www.google.com/index.html”
/>




                                   import.jsp
<c:param>
<c:import url="action_header.jsp">
  <c:param name="title" value="This is the
  header's title"/>
</c:import>




                                  body.jsp
<c:url>
<a href="<c:url value='/jstl/inputComments.jsp'/>">
  Click Here </a>




                                        url.jsp
<c:catch>
<c:catch var="userException">
  <% int x = 1/0; %>
  There is no error...
</c:catch>

<c:if test="${userException != null}">
  There was an exception :
  ${userException.message}
</c:if>
<br/>
Done                                     catch.jsp
JSTL Validator
<%@ taglib uri='WEB-INF/tlds/restrictJavaCode.tld' prefix='rjc'
   %>
<%@ taglib uri='WEB-INF/tlds/restrictTaglibs.tld' prefix='rtl' %>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %>
<html>
<head>
<title>Test Validator</title>

</head>

<body>
<c:out value='This one will pass the test...'/>
<%-- out.println("This one won't"); --%>
</body>
</html>
                                                  jsp/validated.jsp

More Related Content

PPT
JSP Standart Tag Lİbrary - JSTL
PPT
Jstl Guide
PPTX
jstl ( jsp standard tag library )
PDF
JSP Standard Tag Library
PPTX
Sightly - Part 2
PPT
PDF
Expression Language in JSP
PDF
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
JSP Standart Tag Lİbrary - JSTL
Jstl Guide
jstl ( jsp standard tag library )
JSP Standard Tag Library
Sightly - Part 2
Expression Language in JSP
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance

What's hot (20)

PPT
Presentation
PDF
Java Web Programming [5/9] : EL, JSTL and Custom Tags
PDF
Seam Glassfish Slidecast
PPTX
Introduction to JSP
PPTX
Using of TDD practices for Magento
PPT
PDF
Doctrine 2
PDF
Lap trinh web [Slide jsp]
PDF
Jsf Ajax
PPTX
Ajax
PPT
Web Applications and Deployment
PPT
Rich faces
PDF
Angular.js Fundamentals
PDF
Workshop 8: Templating: Handlebars, DustJS
PPTX
Optimizing Magento by Preloading Data
PPT
Система рендеринга в Magento
ODP
JavaScript and jQuery Fundamentals
PPTX
jQuery PPT
PDF
High Performance Django
PDF
AngularJS Basics with Example
Presentation
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Seam Glassfish Slidecast
Introduction to JSP
Using of TDD practices for Magento
Doctrine 2
Lap trinh web [Slide jsp]
Jsf Ajax
Ajax
Web Applications and Deployment
Rich faces
Angular.js Fundamentals
Workshop 8: Templating: Handlebars, DustJS
Optimizing Magento by Preloading Data
Система рендеринга в Magento
JavaScript and jQuery Fundamentals
jQuery PPT
High Performance Django
AngularJS Basics with Example
Ad

Viewers also liked (20)

PPT
PPT
MVC ppt presentation
PDF
Model View Controller (MVC)
PPSX
JDBC: java DataBase connectivity
PPT
Fişinqdən necə qorunmaq olar?
PPTX
Təhlükəsiz proqram təminatının java mühitində hazırlanma texnologiyaları
PPTX
Java proqramlaşdirma mühitində təhlükəsiz proqram təminatinin hazirlanma texn...
PPTX
Struts introduction
PPT
PPTX
Operators and Expressions in Java
PDF
Introduction to Struts 1.3
PPT
java packages
PPSX
Data types, Variables, Expressions & Arithmetic Operators in java
PPS
Packages and inbuilt classes of java
PDF
Operators in java
PPT
PDF
Database recovery techniques
MVC ppt presentation
Model View Controller (MVC)
JDBC: java DataBase connectivity
Fişinqdən necə qorunmaq olar?
Təhlükəsiz proqram təminatının java mühitində hazırlanma texnologiyaları
Java proqramlaşdirma mühitində təhlükəsiz proqram təminatinin hazirlanma texn...
Struts introduction
Operators and Expressions in Java
Introduction to Struts 1.3
java packages
Data types, Variables, Expressions & Arithmetic Operators in java
Packages and inbuilt classes of java
Operators in java
Database recovery techniques
Ad

Similar to Basic JSTL (20)

PPTX
JavaServer Pages
PPT
What is Advance Java J2EE
PPTX
JSP_Complete_Guide_With_Step_By_Step_solution
PDF
JSP TUTORIAL for students M.Sc computer Science
PPTX
4. jsp
TXT
Jsp Notes
PPTX
jsp unit 3byudoue8euwuuutrttttyyii90oigyu7
PPTX
Jsp presentation
PPTX
Introduction to JSP.pptx
PPT
presentation on java server pages vs servlet.ppt
PPTX
Understanding JSP -Servlets
PDF
JSP Syntax_1
PPTX
Jsp and jstl
PDF
PDF
10 jsp-scripting-elements
PPSX
Java server pages
PPTX
JSP.pptx programming guide for beginners and experts
PDF
JavaServer Pages
PPTX
JSP - Java Server Page
JavaServer Pages
What is Advance Java J2EE
JSP_Complete_Guide_With_Step_By_Step_solution
JSP TUTORIAL for students M.Sc computer Science
4. jsp
Jsp Notes
jsp unit 3byudoue8euwuuutrttttyyii90oigyu7
Jsp presentation
Introduction to JSP.pptx
presentation on java server pages vs servlet.ppt
Understanding JSP -Servlets
JSP Syntax_1
Jsp and jstl
10 jsp-scripting-elements
Java server pages
JSP.pptx programming guide for beginners and experts
JavaServer Pages
JSP - Java Server Page

More from corneliuskoo (13)

PDF
Html Hands On
PDF
13 Low Level UI Event Handling
PDF
12 High Level UI Event Handling
PDF
09 Display
PDF
08 Midlet Basic
PDF
07 Midlet On The Web
PDF
06 Eclipse ME
PDF
05 J2ME Wtk Command Line
PDF
04 J2ME Wireless Tool Kit
PDF
03 midp
PDF
02a cldc property support
PDF
02 cldc
PDF
01 java 2 micro edition
Html Hands On
13 Low Level UI Event Handling
12 High Level UI Event Handling
09 Display
08 Midlet Basic
07 Midlet On The Web
06 Eclipse ME
05 J2ME Wtk Command Line
04 J2ME Wireless Tool Kit
03 midp
02a cldc property support
02 cldc
01 java 2 micro edition

Basic JSTL