代码:
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*,bbs.Bbs" errorPage="" %>
<%@ page import="java.sql.*,java.util.*"%>
<%request.setCharacterEncoding("gbk");%>
<%
java.util.Date now=new java.util.Date();
java.sql.Date nowtime=new java.sql.Date(now.getTime());
String ThisTime=(String)nowtime.toString();
%>
<HTML><HEAD><TITLE>测试论坛</TITLE></head>
<body>
<div>
<marquee width="90%" height="12" direction="left" align=right scrollamount=4>
<img src="image/star_level1.gif" width="16" height="16">
<%
Bbs bbs=new Bbs();
String Image="images/newpokp.gif";
ResultSet rs=null;
ResultSet rt=null;
String sql;
sql="select * from affiche order by id desc";
String Notice="";
rs=bbs.query(sql);
while (rs.next())
{
String Time=rs.getString("outtime");
Notice=rs.getString("title")+":<font color=black>"+rs.getString("content")+"</font><font color=gray> "+Time+"</font> "+Notice;
}
out.print(Notice);
rs.close();
%>
</marquee></div>
<div>
<% sql="select * from type order by tid";
String K_Id=null, F_Title=null;
rs=bbs.query(sql);
while(rs.next())
{
K_Id=rs.getString("tid");
F_Title=rs.getString("tname");
%>
<div><%=F_Title%>dgfrdfhg </div>
<% sql="SELECT * FROM kind where tid='"+K_Id+"'";
rt=bbs.query(sql);
while (rt.next())
{
String Time_Str=rt.getString("lasttime");
if((Time_Str.substring(0,10)).equals(ThisTime))
{
Image="images/newpokp1.gif";
}
String Man_Str=rt.getString("lastwriter");
String Forum_id=rt.getString("kid");
String Forum_Mastor=rt.getString("admin");
if (Man_Str==null)
Man_Str="无";
else
Man_Str="<a href='member.jsp?member="+Man_Str+"'>"+Man_Str+"</a>";
if ((Forum_Mastor==null)||(Forum_Mastor.equals("")))
Forum_Mastor="招骋中...";
else
Forum_Mastor="<a href=member.jsp?member="+Forum_Mastor+">"+Forum_Mastor+"</a>";
%><div><img src="image/<%=Image%>" width="25" height="25"></div>
<div><span><a href="board.jsp?fid=<%=Forum_id%>"><%=rt.getString("kname")%></a></span>
<span><%=rt.getString("content")%></span>
<span><%=rt.getString("num")%></span>
<span><%=rt.getString("notenum")%></span>
<span><%=Time_Str%></span>
<span><%=Man_Str%></span>
<span><%=Forum_Mastor%></span>
<span></span><div><%
Image="images/newpokp.gif";
}
rt.close();
}
rs.close();
%>
</div>
</body>
</html>
我改了一天了,改来改去,精简又精简,测试又测试,可还是出现too many servlet includes `/bbs/'错误,实在是让人疯狂啊!