Advertisement
Guest User

showgrades.jsp

a guest
Dec 2nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2. pageEncoding="ISO-8859-1"%> <!-- default import -->
  3. <%@ taglib uri="/WEB-INF/tlds/myTags.tld" prefix="myt" %> <!-- the myt prefix to import the uri from tags -->
  4. <%@ taglib uri="http://sheridancollege.ca/prog32178" prefix="myt1" %> <!-- the custom uri -->
  5. <%@ taglib tagdir="/WEB-INF/tags" prefix="myjsp" %>
  6. <% request.setAttribute("color", "red"); %> <!-- the word Student Marks is going to be red font -->
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  11. <title>Grades</title>
  12. </head>
  13. <body>
  14. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!-- import the c taglib -->
  15. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!-- import the number format tag from the jstl lib -->
  16.  
  17.  
  18. <myt1:helloWithAttr color="${color}"/> <!-- retrieve the attribute from the custom tag servlet -->
  19. <ul> <!-- unordered list -->
  20.  
  21. <c:forEach var="subject" items="${allgrades}">
  22. <li>Student Subject: ${subject.subject} Grade: ${subject.grade}</li> <!-- bulleted list -->
  23. </c:forEach>
  24.  
  25. <!-- the fmt:formatNumber tag below displays the average to one decimal place -->
  26. <c:if test="${avg>80}">
  27. <li><span style="color: green;">Student Average:<fmt:formatNumber type="number" maxFractionDigits="1" value= "${avg}"></fmt:formatNumber>
  28. </span></li> <!-- end span and li tags -->
  29. </c:if>
  30. <c:if test="${avg<80}">
  31. <li><span style="color: blue;">Student Average: <fmt:formatNumber type="number" maxFractionDigits="1" value= "${avg}"></fmt:formatNumber>
  32. </span></li>
  33. </c:if>
  34.  
  35.  
  36. </ul>
  37.  
  38. </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement