• 2021-04-14 问题

    在IE窗口访问JSP页面,其代码如下。然后连续刷新页面,输出的结果是X,紧接着重新启动一个新的IE窗口运行该JSP代码,连续刷新两次,输出的结果是Y,可能的X和Y的值分别是( )。 <%@ page contentType=”text/html; charset=GBK” %> <html> <% Integer cnt = (Integer)application.getAttribute(“hitCount”); if ( cnt == null){ cnt = new Integer(1); }else{ cnt = new Integer(cnt.intValue() +1 ); } application.setAttribute(“hitCount”,cnt); %> <%=cnt%> </html>

    在IE窗口访问JSP页面,其代码如下。然后连续刷新页面,输出的结果是X,紧接着重新启动一个新的IE窗口运行该JSP代码,连续刷新两次,输出的结果是Y,可能的X和Y的值分别是( )。 <%@ page contentType=”text/html; charset=GBK” %> <html> <% Integer cnt = (Integer)application.getAttribute(“hitCount”); if ( cnt == null){ cnt = new Integer(1); }else{ cnt = new Integer(cnt.intValue() +1 ); } application.setAttribute(“hitCount”,cnt); %> <%=cnt%> </html>

  • 1