Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%> <!-- default import -->
- <%@ taglib uri="/WEB-INF/tlds/myTags.tld" prefix="myt" %> <!-- the myt prefix to import the uri from tags -->
- <%@ taglib uri="http://sheridancollege.ca/prog32178" prefix="myt1" %> <!-- the custom uri -->
- <%@ taglib tagdir="/WEB-INF/tags" prefix="myjsp" %>
- <% request.setAttribute("color", "red"); %> <!-- the word Student Marks is going to be red font -->
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Grades</title>
- </head>
- <body>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!-- import the c taglib -->
- <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!-- import the number format tag from the jstl lib -->
- <myt1:helloWithAttr color="${color}"/> <!-- retrieve the attribute from the custom tag servlet -->
- <ul> <!-- unordered list -->
- <c:forEach var="subject" items="${allgrades}">
- <li>Student Subject: ${subject.subject} Grade: ${subject.grade}</li> <!-- bulleted list -->
- </c:forEach>
- <!-- the fmt:formatNumber tag below displays the average to one decimal place -->
- <c:if test="${avg>80}">
- <li><span style="color: green;">Student Average:<fmt:formatNumber type="number" maxFractionDigits="1" value= "${avg}"></fmt:formatNumber>
- </span></li> <!-- end span and li tags -->
- </c:if>
- <c:if test="${avg<80}">
- <li><span style="color: blue;">Student Average: <fmt:formatNumber type="number" maxFractionDigits="1" value= "${avg}"></fmt:formatNumber>
- </span></li>
- </c:if>
- </ul>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement