站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题一种新的编程思路(下):附 bbs之forum.jsp

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

摘要: java jsp sql

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("

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


<head>
闵行办公自动化系统BBS

<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></td>
</tr>
</table>
<table width="750" border="0" cellspacing="1" cellpadding="0" bgcolor="#345487" align="center">
<tr>
<td bgcolor="#EEF2F7" height="20">

title=Search
src="images/top10.gif"
align=absMiddle border=0 name=search width="15" height="15"> 注册
| title=Search
src="images/userlist.gif"
align=absMiddle border=0 name=search width="16" height="16"> 个人资料
| title="Members List"
src="images/yj.gif"
align=absMiddle border=0 name=members width="16" height="16"> 用户登入
| title=Search
src="images/icon_search.gif"
align=absMiddle border=0 name=search width="16" height="15"> 论坛搜索
| title=Search
src="images/gohome.gif"
align=absMiddle border=0 name=search width="15" height="15"> 返回论坛首页
| title=Search
src="images/gohome.gif"
align=absMiddle border=0 name=search width="15" height="15"> 返回OA首页&nbsp;&nbsp;

</td>
</tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td width="31"></td>
<td width="371">
<%@include file="forum_jump_select.jsp"%>
</td>
<td width="372">
">&nbsp;&nbsp;

</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">

</td>
<td background="images/tile_back.gif" width="744">&nbsp;<%= nt.getKV( dbName,"forumDefine", forumId ,"论坛名称") %>&nbsp;&gt;&nbsp;( 版主: <%= nt.getKV( dbName,"forumDefine", forumId ,"斑竹") %> )</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">
主&nbsp;题

</td>
<td width="69" bgcolor="#B5CBEA">
作者

</td>
<td width="65" bgcolor="#B5CBEA">
回复数

</td>
<td width="66" bgcolor="#B5CBEA">
人气指数

</td>
<td width="145" bgcolor="#B5CBEA">
最后发表

</td>
</tr>
<%
for(int i=iStart;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">

&id=<%=_pid%>">" width="20" height="20" border=0>

</td>
<td width="373" bgcolor="#E4EAF2">&id=<%=_pid%>"><%= _name %>&nbsp;</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">
<%=
nt.executeQuery( dbName,
" select * from bbs_article_int where k ='父贴id' and v= "+ _pid +" ")
%>

</td>
<td width="66" bgcolor="#E4EAF2">
<%= nt.getKV( dbName,globalTableName+"_int" , _pid ,"人气") %>

</td>
<td width="145" bgcolor="#E4EAF2">
<%= nt.getKV( dbName,globalTableName+"_datetime" ,_pid ,"发贴时间",0,19) %>

</td>
</tr>
<% } %>
<tr bgcolor="#E4EAF2">
<td colspan="6">

<%@include file="ntPageShow.jsp"%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="31"></td>
<td width="371">
<%@include file="forum_jump_select.jsp"%>
</td>
<td width="372">
">&nbsp;&nbsp;

</td>
</tr>
<form name="form1" method="post" action="">
</form>
</table>


</body>



↑返回目录
前一篇: 一种新的编程思路(下):附 自动分页2-1 ntPage.jsp
后一篇: JSP自学笔记