ServletContextDemo
1、servlet 之间共享数据
package xw.servlet;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 演示向Servletcontext中保存数据
*
*/
public class AServletContext extends HttpServlet { /*
* 1. 获取ServletContext对象
* 2. 调用其setAttribute()方法完成保存数据
*/ public void doGet(HttpServletRequest request, HttpServletResponse response){
ServletContext servletContext=this.getServletContext();
servletContext.setAttribute("name","zhangsan");
}
}
package xw.servlet; import java.io.IOException;
import java.io.PrintWriter; import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 演示从ServletContext中获取数据
*/
public class BServletContext extends HttpServlet {
/*
* 1. 获取ServletContext对象
* 2. 调用其getAttribute()方法完成获取数据
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { ServletContext servletContext=this.getServletContext();
System.out.println(servletContext.getAttribute("name"));
}
}
先运行AServletContext 再运行 BServletContext
2、ServletContext 统计页面访问量
package xw.servlet; import java.io.IOException;
import java.io.PrintWriter; import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 统计访问量
*/
public class CServletContext extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { /*
* 1. 获取ServletContext对象
* 2. 从ServletContext对象中获取名为count的属性
* 3. 如果存在:给访问量加1,然后再保存回去;
* 4. 如果不存在:说明是第一次访问,向Servletcontext中保存名为count的属性,值为1
*/
ServletContext app = this.getServletContext();
Integer count = (Integer)app.getAttribute("count");
if(count == null) {
app.setAttribute("count", );
} else {
app.setAttribute("count", count+);
} /*
* 向浏览器输出
* 需要使用响应对象!
*/
PrintWriter pw = response.getWriter();
pw.print("<h1>" + count + "</h1>");
} }
访问路径,显示效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qVWN0lEVraoOHOXIObie0RWG4gxTDLmUow2/VwhLKUNoI7CSrdiDSC+0TL2Krb8YRNNnGtL7nX55RNPgctMKMtkzlLxJWnoVF5hJx1zET6DzZHJRpxlFUv+6M1Payn+8q57bDWa9rG7MN3cLx23/1qDbse7M2s7abcTCARemMg9OEWxd3Qh8GRzYiWSduMuxkez696H0x0Dk2rUeweBQCD8ZUEgEKg/gnIBgUD9EZQLCATqj6BcQCBQfwTlAgKB+iNq8ASBQCBQX0T/BwAAAHoDKBcAANAfQLkAAID+AMoFAAD0B1AuAACgP4ByAQAA/QGUCwAA6A+gXAAAQH8A5QIAAPoDKBcAANAfQLkAAID+AMoFAAD0B1AuAACgP4ByAQAA/QGUCwAA6A+gXAAAQH8A5QIAAPoD4t5i/7/IGniLS7fVAADg1QYoFwAA0B8uoFzf+W0g3VYDAIBXG+dXrj/5bDLdRgMAgFccSVToA7/9DiZc3/tq/uVbBQAAAFpIqFwnHT//tqxb3/pR7d5lmAUAAAAaSKRce7U/+pYsXN/+ecfJpZgFAAAAGkigXPNffQ+BcAEAgAyDpnKdDHyAl7jgpSIAAMgMaCkXmSlCbR4AAGQKNJSLzBTRD6ugNg8AADID6spFHoaAl4oAACBzoKZc5GEIqM0DAIBMgopyUSUuqM0DAIBMAlu5qBIXCBcAAMgoMJWLLHHBS0UAAJBhYCgXVeKC2jwAAMg0KJWLKnFBbR4AAGQcFMpFZYogXAAAIPNAKReVKUJtHgAAZCJI5aIyRajNAwCAjAShXNRhCPQX/7uSLrsAAABAHbhyUSUueKkIAAAyFLJy0SUuqM0DAIBMhaRcdIkLavMAACBjAf/HNQAA0B9AuQAAgP4AygUAAPQHUC4AAKA/gHIBAAD9AZQLAADoD6BcAABAfwDlAgAA+gMoFwAA0B9AuQAAgP4AygUAAPSH/weLnJuBWllVWgAAAABJRU5ErkJggg==" alt="" />
ServletContextDemo的更多相关文章
- Servlet编程
Servlet编程 1. servlet概念及相关接口简介 java Servlet是运行在web服务器或应用服务器上的程序,他是作为来自web浏览器或其他HTTP客户端的请求和HTTP服务器山的数据 ...
- 显示Servlet API主要版本,次要版本以及服务器系统信息
package com.mhb; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.Servle ...
- Web---演示Servlet的相关类、下载技术、线程问题、自定义404页面
Servlet的其他相关类: ServletConfig – 代表Servlet的初始化配置参数. ServletContext – 代表整个Web项目. ServletRequest – 代表用户的 ...
- 小谈-—ServletConfig对象和servletContext对象
一.servletContext概述 servletContext对象是Servlet三大域对象之一,每个Web应用程序都拥有一个ServletContext对象,该对象是Web应用程序的全局对象或者 ...
- Java Web之Servlet的三大作用域对象
Servlet的作用域是干嘛的?答案就是共享数据而存在的,如图: 下面通过代码演示来具体讲解一下三大作用域 我们新建两个类 package main.com.vae.scope; import jav ...
- Servlet交互与JSP
主要内容介绍 数据共享与页面跳转 1. 为什么要有跳转: Servlet需要跳转到其它Servlet中,因为我们需要职责分明,不同Servlet来完成不同的功能 Servlet跳转到JSP中,Serv ...
- Servlet - Reasource loading
1. Load db3.properties String path = this.getServletContext().getRealPath("/WEB-INF/classes/db/ ...
- tomcat启动失败的三种方法
Tomcat启动失败的解决办法 1. 重复映射 用eclipse开发时,用Eclipse开发,新建了的servlet会有一个url-pattern声明: 这样就不需要再在web.xml中添加映射,如果 ...
- Servlet-授课
1 Servlet 1.1 Servlet概述 Servlet是SUN公司提供的一套规范,名称就叫Servlet规范,它也是JavaEE规范之一.我们可以像学习Java基础一样,通过API来学习Ser ...
随机推荐
- Android广播机制概述
1.Android广播机制概述 Android广播分为两个方面:广播发送者和广播接收者,通常情况下,BroadcastReceiver指的就是广播接收者(广播接收器).广播作为Android组件间的通 ...
- Hark的数据结构与算法练习之希尔排序
算法说明 希尔排序是插入排序的优化版. 插入排序的最坏时间复杂度是O(n2),但如果要排序的数组是一个几乎有序的数列,那么会降低有效的减低时间复杂度. 希尔排序的目的就是通过一个increment(增 ...
- ural 1246. Tethered Dog
1246. Tethered Dog Time limit: 1.0 secondMemory limit: 64 MB A dog is tethered to a pole with a rope ...
- Color the Ball[HDU1199]
Color the Ball Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- CentOS6.4 利用sendEmail发邮件
1.下载安装sendEmail wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz tar z ...
- CentOS6.4 配置LVS(DR模式)
DR模式中LVS主机与实际服务器都有一块网卡连在同一物理网段上. IP分配 VIP:10.10.3.170 RIP1:10.10.3.140 RIP2:10.10.3.141 1.安装所需的依赖包 y ...
- Codeforces Round #195 (Div. 2) D题Vasily the Bear and Beautiful Strings
这场CF,脑子乱死啊...C题,搞了很长时间,结束了,才想到怎么做.B题,没看,D题,今天看了一下,很不错的组合题. 如果n和m都挺多的时候 以下情况都是变为1,根据偶数个0,最后将会为1,奇数个0, ...
- java使用siger 获取服务器硬件信息(CPU 内存 网络 io等)
通过使用第三方开源jar包sigar.jar我们可以获得本地的信息 1.下载sigar.jar sigar官方主页 sigar-1.6.4.zip 2.按照主页上的说明解压包后将相应的文件copy到j ...
- jQuery加载外部文件的方式get、post、ajax、load的区别及异步加载的实现
一.$.post(url, [data], [callback], [type]) url (String) : 发送请求的URL地址. data (Map) : (可选) 要发送给服务器的数据,以 ...
- 【C语言】06-基本数据类型
C语言有丰富的数据类型,因此它很适合用来编写数据库,如DB2.Oracle都是C语言写的. C语言的数据类型大致可以分为下图中的几类: 回到顶部 一.变量 跟其他语言一样,C语言中用变量来存储计算过程 ...