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 页面源代码和源代码。