jsp的application使用案例
2015-09-14 23:05
267 查看
【web.xml页面】
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>InitSer</servlet-name>
<servlet-class>servlet.InitSer</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
【servlet部分】
public void init() throws ServletException {
// Put your code here
ArrayList<Grade> grades=gradeimpl.queryGrade("");
ServletContext app=this.getServletContext();//得到application的一个容器--属于tomcat
app.setAttribute("grades",grades);
String[] slikes={"唱歌","跳舞","篮球","乒乓","足球"};
app.setAttribute("slikes", slikes);
}
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>InitSer</servlet-name>
<servlet-class>servlet.InitSer</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
【servlet部分】
public void init() throws ServletException {
// Put your code here
ArrayList<Grade> grades=gradeimpl.queryGrade("");
ServletContext app=this.getServletContext();//得到application的一个容器--属于tomcat
app.setAttribute("grades",grades);
String[] slikes={"唱歌","跳舞","篮球","乒乓","足球"};
app.setAttribute("slikes", slikes);
}
相关文章推荐
- Android Manifest 用法
- JSP/PHP基于Ajax的分页功能实现
- 开发阶段Jetty运行Jsp报错且响应空白
- 跨越fso、wsh、 application写文件
- IIS 错误 Server Application Error 详细解决方法
- asp 内置对象 Application 详解
- IIS运行错误 Server Application Error 错误代码 Error: 8004的解决方法
- 解决IIS的Server Application Error的2种方法
- Apache Web让JSP“动”起来
- ASP.NET中application对象的使用介绍
- ASP.NET中使用Application对象实现简单在线人数统计功能
- ASP javascript Application对象的Contents和StaticObjects做Cache的一些经验
- javascript之Partial Application学习
- JSP 多条SQL语句同时执行的方法
- 在jsp页面中响应速度提高的7种方法分享
- (jsp/html)网页上嵌入播放器(常用播放器代码整理)
- JSP避免Form重复提交的三种方案