response.sendRedirect(url):重定向
request.getRequestDispatcher(url).forward(req,resp):请求转发
访问计数功能:
<body>
<%
Integer counter=(Integer)application.getAttribute("counter");
if(counter==null)
{
counter=1;
}
else
{
counter++;
}
application.setAttribute("counter", counter);
String realpath=application.getRealPath("/");
%>
<%=counter %><br>
</body>
jsp中的application对象中存放的数据时所有访问该服务器的所共享
session是一对一的,是一次会话有效
一次会话包括多次请求