(JSP) Scriptlet tag code is loaded twice in Chrome

141 views Asked by At

When I load my site and refresh in Chrome, 'cnt' value is added twice..... How can I fix that?

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
    <%! int cnt = 0; %>
    <%
        cnt++;
    %>
    <p><%=cnt %></p>
</body>
</html>

result :
1
3 (after refresh)
5 (after refresh)
7 (after refresh)
.....

I use Tomcat-9.0.37, Google Chrome-84.0.4147.89.
and, when I load that site in Microsort Edge, site has no problem....

0

There are 0 answers