JSP 註釋示例
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>JSP Comments</title>
</head>
<body>
<%-- JSP comments --%> -- Ignored by container, you can't see this comment in source code of JSP_java class translated by container, doesn't include in response
<!-- HTML comments --> -- Ignored by browser, You can see this comment in source code of html page but browser ignores it to print on page, included in response
<% // java comments %> -- Ignored by JRE, This comment can be seen in JSP_java class translated by container, doesn't include in response
<!-- Today is <%= new java.util.Date() %> -->
</body>
</html>
當你執行上面的程式碼時,輸出將是一個空白頁面。要了解這些註釋之間的區別,你需要檢視由容器轉換的 JSP_Java 類的 Web 頁面原始碼和原始碼。