社区
Web 开发
帖子详情
哪位大虾能提供一个JSP内置Application对象应用的例子?
adailee
2002-02-26 03:37:57
我手里只有这样一个简单描述:
对象:Application
类型:javax.servlet.ServletContext
描述:Servler的环境通过调用getServletConfig().getContext()方法获得。
作用域:Application(整个Web应用程序运行期)
请问,如何创建使用这个对象?
...全文
168
5
打赏
收藏
哪位大虾能提供一个JSP内置Application对象应用的例子?
我手里只有这样一个简单描述: 对象:Application 类型:javax.servlet.ServletContext 描述:Servler的环境通过调用getServletConfig().getContext()方法获得。 作用域:Application(整个Web应用程序运行期) 请问,如何创建使用这个对象?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
adailee
2002-02-26
打赏
举报
回复
谢谢。
111222
2002-02-26
打赏
举报
回复
只需要人民币20元,
你就可以获得本灌水机的程序和Visual C++源代码,
并获得永久性技术支持。
还等什么?灌水等着你!
就在今夜!元宵佳节!
(可怜我信誉)
yanchang
2002-02-26
打赏
举报
回复
<%
application.setAttribute("name","value");
%>
<%
String s = (String)application.getAttribute("name");
%>
zxp_net
2002-02-26
打赏
举报
回复
i have
zxp_net
2002-02-26
打赏
举报
回复
liuyan1.jsp
<%
String temp=new String();
temp=(String)application.getAttribute("num");
if(temp==null){
application.setAttribute("num","0");
}
%>
<html>
<head>
<title>留言板</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<p align="center"><b><font size="5" color="#FF6633">留 言 板</font></b></p>
<hr size="1">
<form name="form1" method="post" action="liuyan2.jsp">
<table width="60%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#999999">
<tr bgcolor="#FFFFFF">
<td width="20%">留言作者:</td>
<td width="80%">
<input type="text" name="txtaut">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20%">留言标题:</td>
<td width="80%">
<input type="text" name="txttit">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20%">留言内容:</td>
<td width="80%"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20%"> </td>
<td width="80%">
<textarea name="txtart" cols="45" rows="7"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20%"> </td>
<td width="80%"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">
<div align="center">
<input type="submit" name="cmdok" value="添加到留言薄">
<input type="reset" name="cmdreset" value="重新填写留言">
<input type="button" name="cmdread" value="查看所有留言"
onClick="MM_openBrWindow('liuyan3.jsp'),'','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=400,height=400'">
</div>
</td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
liuyan2.jsp
<html>
<head>
<title>留言板</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<p align="center"><b><font size="5" color="#FF6633">留 言 板</font></b></p>
<hr size="1">
<%
int n;
String temp=new String();
String temp1=new String();
String temp2=new String();
String temp3=new String();
temp1=request.getParameter("txttit");
temp2=request.getParameter("txtaut");
temp3=request.getParameter("txtart");
n=temp1.length()*temp2.length()*temp3.length();
if(n!=0){
temp=(String)application.getAttribute("num");
n=Integer.parseInt(temp);
n=n+1;
temp=temp.valueOf(n);
application.setAttribute("num",temp);
application.setAttribute("tit"+temp,temp1);
application.setAttribute("aut"+temp,temp2);
application.setAttribute("art"+temp,temp3);
%>
<p> </p>
<p align="center">留言成功!</p>
<%
}
else{
%>
<p align="center"><font color="#FF0000">不添加作者、标题和内容,留言失败!</font></p>
<%
}
%>
<p align="center"><a href="liuyan1.jsp">返回首页</a> </p>
</body>
</html>
liuyan3.jsp
<html>
<head>
<title>留言板</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<p align="center"><b><font size="5" color="#FF6633">留 言 板</font></b></p>
<hr size="1">
<%
int n;
String temp=new String();
String temp1=new String();
String temp2=new String();
String temp3=new String();
temp=(String)application.getAttribute("num");
n=Integer.parseInt(temp);
if(n==0){
%>
<p> </p>
<p align="center">目前还没有文章!</p>
<%
}
else{
%>
<table width="60%" border="1" cellspacing="0" cellpadding="5" align="center" bordercolor="#999999">
<%
int i;
for(i=1;i<=n;i++){
temp=temp.valueOf(i);
temp1=(String)application.getAttribute("tit"+temp);
temp2=(String)application.getAttribute("aut"+temp);
temp3=(String)application.getAttribute("art"+temp);
%>
<tr>
<td bgcolor="#CCFFCC" height="27"><b><%=temp%>.标题:<%=temp1%>作者:<%=temp2%></b></td>
</tr>
<tr>
<td><%=temp3%></td>
</tr>
<%
}
}
%>
</table>
<p align="center"> </p>
</body>
</html>
C# For Unity系列之入门篇
有一定自主学习能力,跟着刘老师从“编程小白”修炼为游戏研发“
大虾
”吧!!!学习好Unity,其先决条件是一定要有稳固、扎实的编程基础!课程 《C# For Unity系列之入门篇》配套学习资料链接:...
JSP
实用教程——第二章
JSP
语法
“”标记符号的内容习惯上放在
JSP
页面指令之后,之前,也可以写在与之间。可以在“”标记符号之间定义方法,可以在Java程序片中调用该方法。方法内声明的变量只在该方法内有效,当方法被调用时,方法内声明的变量被分配...
java 未来
最近作了
一个
电子商务项目,由于尝试创新使用了 JAVA SERVLET/
JSP
技术和其他本人不熟悉的技术, 中间吃了很多苦头,反思一下,有些经历与大家分 享,有些问题也想与诸位
大虾
探讨一下。 我们的电子商务项目从...
原dev2dev的WebLogic General精华贴总结
WebLogic General精华贴总结 总结人:周小超(dev2devID:supine) 1. 怎样获得
jsp
页面的物理路径...forumID=126&threadID=17881&tstart=75在
一个
web服务器上,虚拟路径将物理上分离的各文件组合在一起
WEB开发文档2 总结
转自:http://blog.donews.com/lvjiyong/archive/2006/06/29/931071.aspx怎样将后台生成的在内存中的图象显示到客户端Microsoft IE WebControls下载地址如何在DATAGRID中使用JAVASCRIPT脚本控制DataGrid...请
大虾
指教那
Web 开发
81,092
社区成员
341,716
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章