Your SlideShare is downloading. ×
  • Like
Basic JSTL
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,418
On SlideShare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
30
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Core JSTL Cornelius Koo, ST JavaSchool 2005Jl. Cemara 2/20, Salatiga
  • 2. Copy The Libraries
  • 3. Don’t Forget The Taglib<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  • 4. <c:out>
  • 5. <c:out value=Hello World/> out.jsp
  • 6. <c:forEach>
  • 7. <table> <c:forEach var="movie" items="${movieList}" varStatus="movieLoopCount"> <tr> <td>${movieLoopCount.count}</td> <td>${movie}</td> </tr> </c:forEach></table> forEach.jsp
  • 8. <c:if>
  • 9. <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
  • 10. <c:choose>, <c:when>, <c:otherwise>
  • 11. <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
  • 12. <c:set>
  • 13. var for Attribute
  • 14. <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
  • 15. target for Map
  • 16. <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
  • 17. <c:remove>
  • 18. <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
  • 19. <c:import>
  • 20. • It can be use to include static page from outside the web-container.
  • 21. <c:import url=“http://www.google.com/index.html”/> import.jsp
  • 22. <c:param>
  • 23. <c:import url="action_header.jsp"> <c:param name="title" value="This is the headers title"/></c:import> body.jsp
  • 24. <c:url>
  • 25. <a href="<c:url value=/jstl/inputComments.jsp/>"> Click Here </a> url.jsp
  • 26. <c:catch>
  • 27. <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
  • 28. JSTL Validator
  • 29. <%@ 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 wont"); --%></body></html> jsp/validated.jsp