current position:Home>Differences between JSP comments and HTML comments

Differences between JSP comments and HTML comments

2022-04-29 13:19:41Fairy-KunKun

<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href = "<%=basePath%>"/>
    <title>Title</title>
</head>
<body>
    <!-- HTML Notes  -->
    <!-- HTML Your comments are displayed in the browser  -->
    <%-- JSP Notes  --%>
    <%-- JSP Your comments will not be displayed in the browser  --%>
    <%!
        public String dateToString (String style) {
            SimpleDateFormat sdf = new SimpleDateFormat(style);
            Date date = new Date();
            return sdf.format(date);
        }
    %>
     Output the current system time :<%=dateToString("yyyy-MM-dd HH:mm:ss")%>
</body>
</html>

copyright notice
author[Fairy-KunKun],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291117456317.html

Random recommended