JSP之application对象
2015-07-19 18:09
417 查看
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'application.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% application.setAttribute("username", "张三"); application.setAttribute("password", "123456"); application.setAttribute("hobby", "run"); %> <%=application.getAttribute("hobby") %><br/> <% Enumeration<String> attrs = application.getAttributeNames(); while(attrs.hasMoreElements()){ out.println(attrs.nextElement()+" "); } %><br/> <%=application.getServerInfo() %> </body> </html>
相关文章推荐
- IOS TableView滑动不灵敏问题
- IOS数组的排序和筛选
- applicationContext.xml配置
- IOS取消performSelector警告
- Android 中使用Lambda表达式
- applicationContext.xml 配置文件的存放位置
- IOS艺术字及简单的图文混排
- Android中打开raw目录下的数据库文件
- java微信上传永久素材
- IOS计算文字高度
- 【Android】资源系列(二) -- 文件原样保留的资源assets和res/raw目录
- 我的Android进阶之旅------>Android字符串资源中的单引号问题error: Apostrophe not preceded by 的解决办法
- android介绍
- IOS之——快速获取苹果设备UDID(插曲)
- android性能测试工具
- 一个基于Myeclipse开发的Java打地鼠小游戏(Appletcation)
- ios文章list
- android文章list
- ios文章list
- android文章list