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

📄 11-19.txt

📁 jsp常用实例讲解
💻 TXT
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>贴子内容</title>
<body>
<center>
<%@ page language="java" import="java.sql.*" %>
<%-- 连接数据库使用的语句 --%>
<%
String url=new String();
String sql=new String();
url="jdbc:odbc:luntan";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(url);
%>

<%
Statement stat1=conn.createStatement();
int serial=Integer.parseInt(request.getParameter("serial"));
String sql1="select * from db2admin.board where serial_no="+serial;
ResultSet rs=stat1.executeQuery(sql1);
String speaker=new String();
String title=new String();
String content=new String();
String providedate=new String();
out.print("<table border=\"1\" cellspacing=\"0\" width=\"500\" bgcolor=\"#F0F8FF\" >");
out.print("<TR><TD>");
if(rs.next()){
	out.print("<TR><TD align=\"center\">");
	title=rs.getString("title");
	session.putValue("bbstitle",title);
	out.print("<font color=\"blue\"><b>");
	out.print("主题:"+title);
	out.print("</font></b>");
	out.print("<BR>");
	out.print("<font color=\"red\">");
	speaker=rs.getString("speaker");
	out.print("发贴人:"+speaker);
	out.print("</font>"); 
	out.print("&nbsp;&nbsp;&nbsp;");
	out.print("<font color=\"green\">");
	providedate=rs.getString("provide_time");
	out.print("发贴时间:"+providedate);
	out.print("</font>");
	out.print("</TD></TR>");
	out.print("<TR><TD>");
	out.print("贴子内容:");
	content=rs.getString("content");
	out.print(content);
}
out.print("</p></td></tr></table>");
rs.close();
stat1.close();

//添加点击数量
Statement stat2=conn.createStatement();
String sql2="update db2admin.board set click_num=click_num+1 where serial_no="+serial;
stat2.executeUpdate(sql2);

stat2.close();
conn.close();
%>
<%
String username=(String)session.getValue("username");
String bbstitle=(String)session.getValue("bbstitle");
%>
<p><h4><Font color="blue">回复贴子</font></h4></p>
<form method="POST" action="reply.jsp?serial=<%= serial%>">
<center>
<table border="1" cellspacing="0" width="500" bgcolor="#F0F8ff">
<TR>
<TD>回复人:<fotn color="red"><%=username%></font></td>
</TR>
<TR>
<td>主题:<input type="text" name="title"  maxlength="80" value="<%=bbstitle%>"></td>
</TR>
<TR>
<td valign="top">内容:<TextArea name="replycontent" cols="50" rows="4" maxlength="80"></textarea>
</td>
</TR>
<TR>
<TD align="center"><input type="submit" value="提交" >&nbsp;&nbsp;&nbsp;
<input type="reset" value="取消"></td>
</tr>
</table>
</center>
</form>
</center>
<p align="center"><a href="javascript:window.close();">关闭</a></p>
</body>
</html>

⌨️ 快捷键说明

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