⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.jsp

📁 一个小型的BBS系统
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=gb2312"    pageEncoding="gb2312"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>论坛主页</title>
<style type="text/css">
</style>
</head>

<body>

<table width="921" height="379" border="2" align="center">
  <tr>
    <th height="51" colspan="2" scope="col">&nbsp;</th>
    <th width="298" rowspan="2" scope="col"><div align="center"><span class="STYLE2">软件工程交流论坛</span></div></th>
    <th colspan="2" scope="col">&nbsp;</th>
  </tr>
 
  
  <%
String id;
String control;
String author;

id = (String)session.getAttribute("name");
author = (String)session.getAttribute("author");
control = (String)session.getAttribute("control");

if(id!=null){
%>
   <tr>
    <td width="150"><div align="center">用户ID:<%=id %></div></td>
    <td width="154" height="17"> <div align="center">昵称: <%=author %></div></td>
    <td width="170"><div align="center"><a href="/bbs_design/ReqServlet?action=login">用户登陆</a> </div></td>
    <td width="115"><div align="center"><a href="/bbs_design/ReqServlet?action=register">新用户注册</a></div></td>
  </tr>
 
 
	 
   <%	
}
else{
	id ="visitor";
	control="0";
	session.setAttribute("name","visitor");
	session.setAttribute("author","游客");
	session.setAttribute("control","0");
%>
  <tr>
    <td width="150"><div align="center">用户ID:<%=id %></div></td>
    <td width="154" height="17"> <div align="center">昵称: 游客</div></td>
    <td width="170"><div align="center"><a href="/bbs_design/ReqServlet?action=login">用户登陆</a> </div></td>
    <td width="115"><div align="center"><a href="/bbs_design/ReqServlet?action=register">新用户注册</a></div></td>
  </tr>
  <tr>
    <td height="23">&nbsp;</td>
    <td height="23">&nbsp;</td>
    <td width="298" height="23">&nbsp;</td>
    <td height="23">&nbsp;</td>
    <td height="23">&nbsp;</td>
  </tr>
   <%} %> 
   
   <%
if(!id.equals("visitor")){%>
	
	<%
	if(control.equals("2")){%>
	<tr>
    <td height="23"><a href="/bbs_design/ReqServlet?action=usermanage">用户管理</a></td>
    <td height="23"><a href="/bbs_design/ReqServlet?action=statemanage">版块管理</a></td>
    
  
  <% }
	else { %>
     <tr>
    <td height="23">&nbsp;</td>
    <td height="23">&nbsp;</td>
  
<% 	}%>
     <td width="298" height="23">
     <jsp:useBean id="cm" scope="session" class="bean.check.CheckMessage" />
     <a href="/bbs_design/ReqServlet?action=message&userid=<%=id %>">短消息</a>&nbsp未读<%=cm.CheckUnReadMessage(id) %>个</td>
     <td height="23"><a href="/bbs_design/ReqServlet?action=usercontrolform&userid=<%=id %>">控制面板</a> </td>
     <td height="23"><a href="/bbs_design/ReqServlet?action=quit">安全退出</a></td>
     </tr>

<%}
%>
    
  <tr>
    <td height="155" colspan="5"><div align="center">
 

<table width="700" border="1">
  <tr>
    <%
	if(!control.equals("0")){%>
		<th width="87" scope="col">状态</th>
	<% 
	}
	%>
	
    
    <th width="262" scope="col" colspan=30>版块名称</th>
    <th width="159" scope="col">当前贴数</th>
    <th width="164" scope="col">现任版主</th>
  </tr>

<% 
//准备连接数据库 
java.sql.Connection conn;
java.sql.Statement stmt;
java.sql.ResultSet rs;
%>
<jsp:useBean id="bbscon" scope="session" class="bean.condb.Condb" />
<%
conn=bbscon.con();
stmt = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
String bbsstate;
int num;
String master;
String url;
int del=0;
String statename="";
String sql;
sql = "select * from bbsstate";
rs = stmt.executeQuery(sql);
%>
<% 
while(rs.next()){
	bbsstate = rs.getString(1);
	num = rs.getInt(2);
	master = rs.getString(3);
	url = rs.getString(4);
	del = rs.getInt(5);
	statename = rs.getString(6);
	if(!bbsstate.equals("hr")){
	%>
	<%
		if(del==1 && control.equals("0")){
			
		}
		else{
	%>
	<tr>
		<%
		if(del==0 && !control.equals("0")){%>
			<td width="87" scope="col">正常</td>
		<% 	
		}
		else if(del==1 && !control.equals("0")){%>
			<td width="87" scope="col">封</td>
		<% 	
		}
		%>
		
		<th width="262" scope="col" colspan=30><a href="http://127.0.0.1:8080/bbs_design/ReqServlet<%=url %>&bbsstate=<%=bbsstate %>&pageview=1"><%=statename %></a> </th>
		<th width="159" scope="col"><%=num %></th>
	    <th width="164" scope="col"><%=master %></th>     
	<%}
	}
	else{
	%>
	<hr>
	<%} 
} %>
</table>
    
 </div>   
</td>
  </tr>
</table>


</body></html>

⌨️ 快捷键说明

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