下面这个是查看留言信息的代码
不知道为什么只能显示单词
汉字不能显示麻烦大哥大姐帮忙解决下
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY>
<head>
<title>
留言板
</title>
</head>
<div align="center">
留言信息
<hr color="red">
<%
int n;
String temp=(String)application.getAttribute("num");
n=Integer.parseInt(temp);
if(n==0)
{
%>
<font size="5">目前没有文章,欢迎留言!</font>
<a href="liuyan.jsp"><br><br>返回留言版首页</a>
<%
}
else
{
%>
<table width="500" border="1" cellspacing="1" cellpadding="5">
<%
int i;
for(i=1;i<n;i++)
{
temp=temp.valueOf(i);
String tit=(String)application.getAttribute("tit"+temp);
String aut=(String)application.getAttribute("aut"+temp);
String art=(String)application.getAttribute("art"+temp);
%>
<tr bgcolor="#ff3333">
<td height="30">
NO.<%=temp%> <%=tit%>
</td>
</tr>
<tr bgcolor="#ffffcc" align="left" valign="top">
<td>
<%=art%>
</td>
</tr>
<tr bgcolor="#ff66ff" align="right">
<td height="30">
作者:<%=aut%>
</td>
</tr>
<%
}
}
%>
</div>
</BODY>
</HTML>
不知道为什么只能显示单词
汉字不能显示麻烦大哥大姐帮忙解决下
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY>
<head>
<title>
留言板
</title>
</head>
<div align="center">
留言信息
<hr color="red">
<%
int n;
String temp=(String)application.getAttribute("num");
n=Integer.parseInt(temp);
if(n==0)
{
%>
<font size="5">目前没有文章,欢迎留言!</font>
<a href="liuyan.jsp"><br><br>返回留言版首页</a>
<%
}
else
{
%>
<table width="500" border="1" cellspacing="1" cellpadding="5">
<%
int i;
for(i=1;i<n;i++)
{
temp=temp.valueOf(i);
String tit=(String)application.getAttribute("tit"+temp);
String aut=(String)application.getAttribute("aut"+temp);
String art=(String)application.getAttribute("art"+temp);
%>
<tr bgcolor="#ff3333">
<td height="30">
NO.<%=temp%> <%=tit%>
</td>
</tr>
<tr bgcolor="#ffffcc" align="left" valign="top">
<td>
<%=art%>
</td>
</tr>
<tr bgcolor="#ff66ff" align="right">
<td height="30">
作者:<%=aut%>
</td>
</tr>
<%
}
}
%>
</div>
</BODY>
</HTML>
加上
我用下面这段代码实现计数功能
但要求不能一直在一台电脑上不断刷新
麻烦大哥大姐们看下有没有哪里出问题
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<body>
<%! int i=1; %>
<%
if(session.isNew())
{
i++;
}
else{
i+=0;}
%>
<p align="center"><FONT size="2">历史访问量<%= i %>人</FONT> </p>
</body>
</html>
是指不能让用户自己刷点击率吧?把已点击的文章或者什么东西的ID保存在cookie中。每次做下比较久好了。