jsp问题 求解 求解
把下面代码改成 刷新不会加 求大神帮忙 不甚感谢 <%@ page contentType="text/html; charset=gb2312"%>
<%
int number=0;
if(application.getAttribute("number")==null){
number=1;
}else{
number=Integer.parseInt((String)application.getAttribute("number"));
number=number+1;
}
out.print("你是第"+number+"访问者");
application.setAttribute("number",String.valueOf(number));
%>
搜索更多相关主题的帖子:
jsp
----------------解决方案--------------------------------------------------------
这个代码能运行吗,看着明显有低级错误
----------------解决方案--------------------------------------------------------
楼主应该看看9大域对象
application是不行的
应该是判断session.getAttribute("number")
----------------解决方案--------------------------------------------------------
application的作用域略大,此处确实不合适,但也是能用的,就是你想要的是什么还不是很理解,你现在只是在读取和存放number的值而已
----------------解决方案--------------------------------------------------------