JSP Page :Template Text

Any non-JSP code located inside a JSP page is known as template text. Template text can take any form aslong as it's text based. The most common form of template text is markup such as HTML or XML. For example, if your web design team was to develop an HTML page that you were required to convert into aJSP page in order to add some form of dynamic processing, then all of the HTML markup would be referred to as template text:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page import="com.Calendar"%>
<html>
<head>
<title>My HTML Example</title>
</head>
<body>
<jsp:useBean id="cal" class="com.Calendar"/>
<c:set var="hour" value="${cal.hour}" scope="request" />
<c:choose>
<c:when test="${hour > 0 && hour <=11}">
Good Morning!
</c:when>
<c:when test="${hour >= 12 && hour <=17}">
Good Afternoon!
</c:when>
<c:otherwise>
Good Evening!
</c:otherwise>
</c:choose
</body>
</html>

No comments:

Post a Comment