SlideShare a Scribd company logo
1 of 30
Download to read offline
Core JSTL

    Cornelius Koo, ST
       JavaSchool
          2005
Jl. Cemara 2/20, Salatiga
Copy The Libraries
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

What's hot

Introduction to JSP
Introduction to JSPIntroduction to JSP
Introduction to JSP
Geethu Mohan
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
Magecom Ukraine
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
BG Java EE Course
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
DjangoCon2008
 

What's hot (20)

Presentation
PresentationPresentation
Presentation
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
Seam Glassfish Slidecast
Seam Glassfish SlidecastSeam Glassfish Slidecast
Seam Glassfish Slidecast
 
Introduction to JSP
Introduction to JSPIntroduction to JSP
Introduction to JSP
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
 
Jsp
JspJsp
Jsp
 
Doctrine 2
Doctrine 2Doctrine 2
Doctrine 2
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 
Ajax
AjaxAjax
Ajax
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Rich faces
Rich facesRich faces
Rich faces
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
 
Workshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJSWorkshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJS
 
Optimizing Magento by Preloading Data
Optimizing Magento by Preloading DataOptimizing Magento by Preloading Data
Optimizing Magento by Preloading Data
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 

Viewers also liked

Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
Abhilash Nair
 

Viewers also liked (20)

Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Jdbc Ppt
Jdbc PptJdbc Ppt
Jdbc Ppt
 
Fişinqdən necə qorunmaq olar?
Fişinqdən necə qorunmaq olar?Fişinqdən necə qorunmaq olar?
Fişinqdən necə qorunmaq olar?
 
Təhlükəsiz proqram təminatının java mühitində hazırlanma texnologiyaları
Təhlükəsiz proqram təminatının java mühitində hazırlanma texnologiyalarıTəhlükəsiz proqram təminatının java mühitində hazırlanma texnologiyaları
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...
Java proqramlaşdirma mühitində təhlükəsiz proqram təminatinin hazirlanma texn...Java proqramlaşdirma mühitində təhlükəsiz proqram təminatinin hazirlanma texn...
Java proqramlaşdirma mühitində təhlükəsiz proqram təminatinin hazirlanma texn...
 
Struts introduction
Struts introductionStruts introduction
Struts introduction
 
Xml
XmlXml
Xml
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
 
Introduction to Struts 1.3
Introduction to Struts 1.3Introduction to Struts 1.3
Introduction to Struts 1.3
 
java packages
java packagesjava packages
java packages
 
Data types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in javaData types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in java
 
Packages and inbuilt classes of java
Packages and inbuilt classes of javaPackages and inbuilt classes of java
Packages and inbuilt classes of java
 
Operators in java
Operators in javaOperators in java
Operators in java
 
RMI
RMIRMI
RMI
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
Xml
XmlXml
Xml
 

Similar to Basic JSTL

Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
Yehuda Katz
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 
The project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicerThe project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicer
Andrei Hortúa
 
Os Pruett Sessionnotes
Os Pruett SessionnotesOs Pruett Sessionnotes
Os Pruett Sessionnotes
oscon2007
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
ady36
 

Similar to Basic JSTL (20)

Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFaces
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
BPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced WorkflowsBPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced Workflows
 
JSP
JSPJSP
JSP
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
JS-05-Handlebars.ppt
JS-05-Handlebars.pptJS-05-Handlebars.ppt
JS-05-Handlebars.ppt
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in Rails
 
The project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicerThe project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicer
 
Os Pruett Sessionnotes
Os Pruett SessionnotesOs Pruett Sessionnotes
Os Pruett Sessionnotes
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
 
Php
PhpPhp
Php
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...
 

More from corneliuskoo

More from corneliuskoo (13)

Html Hands On
Html Hands OnHtml Hands On
Html Hands On
 
13 Low Level UI Event Handling
13 Low Level UI Event Handling13 Low Level UI Event Handling
13 Low Level UI Event Handling
 
12 High Level UI Event Handling
12 High Level UI Event Handling12 High Level UI Event Handling
12 High Level UI Event Handling
 
09 Display
09 Display09 Display
09 Display
 
08 Midlet Basic
08 Midlet Basic08 Midlet Basic
08 Midlet Basic
 
07 Midlet On The Web
07 Midlet On The Web07 Midlet On The Web
07 Midlet On The Web
 
06 Eclipse ME
06 Eclipse ME06 Eclipse ME
06 Eclipse ME
 
05 J2ME Wtk Command Line
05 J2ME Wtk Command Line05 J2ME Wtk Command Line
05 J2ME Wtk Command Line
 
04 J2ME Wireless Tool Kit
04 J2ME Wireless Tool Kit04 J2ME Wireless Tool Kit
04 J2ME Wireless Tool Kit
 
03 midp
03 midp03 midp
03 midp
 
02a cldc property support
02a cldc property support02a cldc property support
02a cldc property support
 
02 cldc
02 cldc02 cldc
02 cldc
 
01 java 2 micro edition
01 java 2 micro edition01 java 2 micro edition
01 java 2 micro edition
 

Basic JSTL