6-15.txt

来自「jsp常用实例讲解」· 文本 代码 · 共 60 行

TXT
60
字号
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>一个简单的留言板</title>
</head>
<body bgcolor="#66CCFF">
<%-- 检查number变量的大小 --%>
<%
int n;
String getnumber=new String();
String getauthor=new String();
String gettitle=new String();
String getcontent=new String();
getnumber=(String)application.getAttribute("number");
%>
<p align="center"><b><font size="5" face="华文新魏" color="#FFFFFF">一个简单的留言板</font></b>
<p align="right"><b><font size="2" >目前共有 <%=getnumber%> 条留言</font></b>
<hr>
<div align="center">
<center>
<%
n=Integer.parseInt(getnumber);
if(n==0){
%>
   <font color="#0000FF"><b>留言板上没有任何留言!</b></font>
<%   
}   
else {   
%>   
   <table border="1" width="70%" cellspacing="1">   
<%   
int i;   
for(i=1;i<=n;i++){   
getnumber=getnumber.valueOf(i);   
getauthor=(String)application.getAttribute("author"+getnumber);   
gettitle=(String)application.getAttribute("title"+getnumber);   
getcontent=(String)application.getAttribute("content"+getnumber);   
%>   
    <tr>   
      <td width="26%" bgcolor="#008080"><b><font color="#FF00FF">作者:</font><font color="#FFFFFF"><%=getauthor%></font></b></td>  
      <td width="74%" bgcolor="#008080"><b><font color="#FF00FF">标题:</font><font color="#FFFFFF"><%=gettitle%></font></b></td>  
    </tr>  
    <tr>  
      <td width="100%" colspan="2"><%=getcontent%></td>  
    </tr>  
<%  
}  
%>  
</table>  
<%  
}  
%>  
</center>  
</div>  
</body>  
</html>  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?