CSDN博客

img newtower

一种新的编程思路(下):附 bbs之forum.jsp

发表于2002/7/15 10:07:00  759人阅读

forum.jsp

--------------------------------------------------------------------------

<%@page contentType="text/html;charset=GBK" %>
<%@include file="head.jsp"%>

<%@include file="ntGBDP2002_Define.jsp" %>
<%
  file://全局变量定义
  globalTableName = "bbs_article";
  parentKey       = "帖子";
  parentValue     = "";
  dbName          = "mhoa";
%>

<%
  int forumId = 0;
  if( request.getParameter("forumId") == null )
  {
    out.println("<script>alert('没有指定论坛: forumId !');history.back();</script>");
    return;
  }
  forumId = Integer.parseInt(request.getParameter("forumId"));
 
  sql =
    " select top "+ maxReturnRows +" * from " + globalTableName + "_datetime " +
    "   where k ='改贴时间' "+
    "    and pid in ( select id from " + globalTableName + "_main "+
    "          where k='"+parentKey+"' and v='"+parentValue+"' ) "+
    "    and pid in ( select pid from " + globalTableName + "_int "+
    "          where k='论坛id' and v = "+ forumId +" ) "+
    "    and pid in ( select pid from " + globalTableName + "_int "+
    "          where k='父贴id' and v = 0 ) "+
    "   order by v desc "+
    ""; 
  ntP.executeQuery( dbName , sql);
 
  file://校正次序
 
 
  out.println("<!-- "+ sql +" -->");
%>

<%@include file="ntPage.jsp"%>

<html>
<head>
<title>闵行办公自动化系统BBS</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/mhs.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="750" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
  <tr>
    <td><img src="images/bbs_top.gif" width="750" height="59"></td>
  </tr>
</table>
<table width="750" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
  <tr>
    <td bgcolor="#EEF2F7" height="20">
      <div align="right"><img
            title=Search
            src="images/top10.gif"
            align=absMiddle border=0 name=search width="15" height="15"> <a href="register.jsp">注册</a>
        | <img
            title=Search
            src="images/userlist.gif"
            align=absMiddle border=0 name=search width="16" height="16"> <a href="data.jsp">个人资料</a>
        | <img
            title="Members List"
            src="images/yj.gif"
            align=absMiddle border=0 name=members width="16" height="16"> <a href="login.jsp">用户登入</a>
        | <img
            title=Search
            src="images/icon_search.gif"
            align=absMiddle border=0 name=search width="16" height="15"> <a href="bbs_search.jsp">论坛搜索</a>
        | <img
            title=Search
            src="images/gohome.gif"
            align=absMiddle border=0 name=search width="15" height="15"> <a href="bbs.jsp">返回论坛首页</a>
        | <img
            title=Search
            src="images/gohome.gif"
            align=absMiddle border=0 name=search width="15" height="15"> <a href="../index.jsp">返回OA首页</a>&nbsp;&nbsp;
      </div>
    </td>
  </tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="3" align="center">
  <tr>
    <td width="31"><img src="images/nav.gif" width="21" height="21"></td>
    <td width="371">
      <%@include file="forum_jump_select.jsp"%>
    </td>
    <td width="372">
      <div align="right"><a href="newthread.jsp?forumId=<%= request.getParameter("forumId")%>"><img src="images/t_new.gif" width="89" height="25" border="0"></a>&nbsp;&nbsp;</div>
    </td>
  </tr>
  <tr>
    <td colspan="3">
      <table width="750" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
        <tr>
          <td background="images/tile_back.gif">
            <table width="750" border="0" cellspacing="0" cellpadding="0" align="center" height="20">
              <tr>
                <td background="images/tile_back.gif" width="31">
                  <div align="center"><img src="images/nav_m.gif" width="8" height="8"></div>
                </td>
                <td background="images/tile_back.gif" width="744">&nbsp;<font color="#FFFFFF"><%= nt.getKV( dbName,"forumDefine", forumId ,"论坛名称") %>&nbsp;&gt;&nbsp;( 版主: <%= nt.getKV( dbName,"forumDefine", forumId ,"斑竹") %> )</font></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table width="750" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
        <tr>
          <td bgcolor="#FFFFFF">
            <table width="750" border="0" cellspacing="1" cellpadding="2">
              <tr>
                <td colspan="2" bgcolor="#B5CBEA">
                  <div align="center"><font color="#3A4F6C">主&nbsp;题</font></div>
                </td>
                <td width="69" bgcolor="#B5CBEA">
                  <div align="center"><font color="#3A4F6C">作者</font></div>
                </td>
                <td width="65" bgcolor="#B5CBEA">
                  <div align="center"><font color="#3A4F6C">回复数</font></div>
                </td>
                <td width="66" bgcolor="#B5CBEA">
                  <div align="center"><font color="#3A4F6C">人气指数</font></div>
                </td>
                <td width="145" bgcolor="#B5CBEA">
                  <div align="center"><font color="#3A4F6C">最后发表</font></div>
                </td>
              </tr>
<%       
  for(int i=iStart;i<iCount;i++) {
    int _pid = Integer.parseInt( ntP.data(i,"pid"));

    String _name = nt.getKV( dbName,globalTableName ,_pid ,"贴子标题");
    if( _name.equals("") )
      _name = "( 空 )";
    if( !nt.getKV( dbName,globalTableName+"_int" ,_pid ,"父贴id").equals("0") )
      _name = "&nbsp;&nbsp;"+_name;   
%>
    
              <tr>
                <td width="27" bgcolor="#E4EAF2">
                  <div align="center"><a href="newthread.jsp?forumId=<%= forumId %>&id=<%=_pid%>"><img src="face/<%= nt.getKV( dbName,globalTableName ,_pid ,"表情图标") %>" width="20" height="20" border=0></a>
                  </div>
                </td>
                <td width="373" bgcolor="#E4EAF2"><a href="showthread.jsp?forumId=<%= forumId %>&id=<%=_pid%>"><%= _name %>&nbsp;</a></td>
                <td width="69" bgcolor="#E4EAF2" align="center" >
                  <%=
                  nt.getKV( dbName,"bbs_users" ,nt.getKV( dbName,globalTableName+"_int" ,_pid ,"发贴人id"),"用户名")
                   %>
                </td>
                <td width="65" bgcolor="#E4EAF2">
                  <div align="center"><%=
  nt.executeQuery( dbName,
    " select * from bbs_article_int where k ='父贴id' and v= "+ _pid +" ")
%></div>
                </td>
                <td width="66" bgcolor="#E4EAF2">
                  <div align="center"><%= nt.getKV( dbName,globalTableName+"_int" , _pid ,"人气") %></div>
                </td>
                <td width="145" bgcolor="#E4EAF2">
                  <div align="center"><%= nt.getKV( dbName,globalTableName+"_datetime" ,_pid ,"发贴时间",0,19) %></div>
                </td>
              </tr>
<% } %>    
              <tr bgcolor="#E4EAF2">
                <td colspan="6"> <br>
                  <%@include file="ntPageShow.jsp"%>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="31"><img src="images/nav.gif" width="21" height="21"></td>
    <td width="371">
      <%@include file="forum_jump_select.jsp"%>
    </td>
    <td width="372">
      <div align="right"><a href="newthread.jsp?forumId=<%= request.getParameter("forumId")%>"><img src="images/t_new.gif" width="89" height="25" border="0"></a>&nbsp;&nbsp;</div>
    </td>
  </tr>
  <form name="form1" method="post" action="">
  </form>
</table>
<br>
</body>
</html>

0 0

相关博文

我的热门文章

img
取 消
img