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

📄 update.jsp

📁 一个使用jdbc存储和调用大对象(比如图片等)的例子
💻 JSP
字号:
<html>
<head>
<title>BBS</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" Href="bbs.css">
</head>
<script language="javascript">
function checkForm() {
	if (document.form1.topic.value == "") {
		alert("文章的主题不能为空!");
		form1.topic.focus();
		return false;
	}
	return true;
}

function openWindow(url) {
	var newWin = window.open(url,"","toolbar=no,status=no,menubar=no,width=330,height=260");
	return false;
}
</script>
<body bgcolor="#FFF9F0">
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="BoardBean" scope="page" class="database.OPDB" /> 
<%
BoardBean.connection();
Connection conn = BoardBean.getConn();
String id = request.getParameter("id");
String boardid = request.getParameter("boardid");
String sql = "select lasttime,topic,name,face,text,linktopic,linkurl,email,type from t_bbs";
sql += " where id = " + id;
ResultSet rs = BoardBean.select(conn,sql);

rs.next();
String lasttime = rs.getString("lasttime");
String topic = BoardBean.GBK(rs.getString("topic").trim());
String nameUncode = rs.getString("name");
String name = BoardBean.GBK(nameUncode);
int face = rs.getInt("face");
String text = BoardBean.GBK(rs.getString("text"));
String linktopic = BoardBean.GBK(rs.getString("linktopic"));
String linkurl = rs.getString("linkurl");
String email = rs.getString("email");
String type = BoardBean.GBK(rs.getString("type"));
if (linkurl == null) linkurl = "";
if (linktopic == null) linktopic = "";
if (email == null) email = "";
rs.close();

String username = (String) session.getValue("username");
if (username == null) {	
%>
	你只能以过客的名字发表文章,无法取得经验值,如果你没有登陆,请<a Href="logon.jsp" onclick="return openWindow(this.href);"><font color="red">登陆</font></a>,如果你没有注册,请<a href="register.htm" onclick="return openWindow(this.href);"><font color="red">注册!</font></a><p>
<%
}
%>
<font size="3"><b>第<font color="#CC0000"><%= id %></font>帖--<%= topic %></b></font>
<hr color="FF9900" size="1">
热线公告:<font color="0000cc"><b><%= name %></b></font> <%= lasttime %>  这样 <img src = "images/mod<%= face %>.gif"> 写到:     斑竹管理: <a href="delete.jsp?boardid=<%= boardid %>&id=<%= id %>&writename=<%= name %>" onclick="return openWindow(this.href);">删除帖子</a> <a href="addgood.jsp?boardid=<%= boardid %>&id=<%= id %>&writename=<%= name %>" onclick="return openWindow(this.href);">加入精华</a><p>
<p>

<form action=update_write.jsp method=post name="form1">
<table border=0 cellspacing=0 cellpadding=0 align=center width="100%">
<tr> 
<td> 
<br> 主题<br>
<input name=topic size=50 value="<%= topic %>" >
<input type="hidden" name="boardid" value="<%= boardid %>">
<input type="hidden" name="id" value="<%= id %>">
<select name="type" >
<option value="原创" <% if(type.equals("原创")) out.print("selected"); %>>原创</option>
<option value="转帖" <% if(type.equals("转帖")) out.print("selected"); %>>转帖</option>
</select>
</p>
</td>
</tr>
<tr> 
<td valign="top"><br>
表情 
<table width="350" border="0">
<tr> 
<td> 
<input type="radio" name="face" value="1" <% if(face==1) out.print("checked"); %>>
<img src="images/mod1.gif" width="20" height="20" ></td>
<td> 
<input type="radio" name="face" value="2" <% if(face==2) out.print("checked"); %>>
<img src="images/mod2.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="3" <% if(face==3) out.print("checked"); %>>
<img src="images/mod3.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="4" <% if(face==4) out.print("checked"); %>>
<img src="images/mod4.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="5" <% if(face==5) out.print("checked"); %>>
<img src="images/mod5.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="6" <% if(face==6) out.print("checked"); %>>
<img src="images/mod6.gif" width="20" height="20"></td>
</tr>
<tr> 
<td> 
<input type="radio" name="face" value="7" <% if(face==7) out.print("checked"); %>>
<img src="images/mod7.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="8" <% if(face==8) out.print("checked"); %>>
<img src="images/mod8.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="9" <% if(face==9) out.print("checked"); %>>
<img src="images/mod9.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="10" <% if(face==10) out.print("checked"); %>>
<img src="images/mod10.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="11" <% if(face==11) out.print("checked"); %>>
<img src="images/mod11.gif" width="20" height="20"></td>
<td> 
<input type="radio" name="face" value="12" <% if(face==12) out.print("checked"); %>>
<img src="images/mod12.gif" width="20" height="20"></td>
</tr>
</table>

</td>
</tr>
<tr> 
<td> 
<p> <br>
发表文章(最多2000字)<br>
<textarea name=text cols=70 rows=10 ><% if(text != null) out.print(text); %></textarea>
</p>
</td>
</tr>
<tr> 
<td> <br>
电子邮件: 
<input name=email size=40 value=<%= email %>>
</td>
</tr>
<tr> 
<td> 链接标题: 
<input name=linktopic size=40 value=<%= linktopic %>>
</td>
</tr>
<tr> 
<td> 链接地址: 
<input name=linkurl size=40 <%= linkurl %>>
</td>
</tr>
</table><p>
<table border=0 cellspacing=0 cellpadding=0 align=center>
<tr> 
<td align="center">

<table width="50%" border="0">
<tr> 
<td>
<input type="submit" name="Submit2" value="提交" onclick="return checkForm();">
</td>
<td> 
<input type="reset" name="Submit3" value="重写">
</td>

</tr>
</table>

</td>
</tr>
</table>
</form>
<p> 
<div align=center><hr color="FF9900" size=1> 
<p align="center"> <a href="../index.jsp" target="_top">返 回 首 页</a> 
</div> 
	
</body>
</html>

⌨️ 快捷键说明

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