📄 modify.jsp
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@page import="
java.sql.*,
javax.sql.*,
javax.naming.*,
com.aheadedu.fen.bean.*,
com.aheadedu.fen.service.*"
%>
<%
String username=(String)session.getAttribute("username");
if(username==null || username.equals("")){
%>
<script language="javascript">
location='../index.jsp';
</script>
<%
}
%>
<%
String newsid=request.getParameter("newsid");
if(newsid==null || newsid.equals("")){
%>
<script language="javascript">
location='index.jsp';
</script>
<%
}
session.setAttribute("newsid",newsid);
%>
<html>
<head>
<title>修改新闻</title>
<style type="text/css">
<!--
.STYLE2 {
color: #999999;
font-size: 10px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE5 {
font-size: 14px;
color: #000000;
}
.STYLE1 {color: #FF0000}
.STYLE7 {font-size: 12px}
.STYLE8 {font-size: 14px}
.STYLE10 {color: #003399}
-->
</style>
<script language="javascript">
function check(nfid){
if(confirm('确定删除?')){
location='delfile.jsp?newsid_delfile=<%=newsid%>&nfid='+nfid;
}
}
</script>
</head>
<%
String title="";
String content="";
String ispub="";
String kind="";
NewsService ns=new NewsService("jdbc/news");
Connection con=ns.getCon();
//for managerfile
PreparedStatement ps4=con.prepareStatement("select * from news_file where newsid=?");
ps4.setString(1,newsid);
ResultSet rs4=ps4.executeQuery();
//for list kind
Statement stmt=con.createStatement();
ResultSet rs2=stmt.executeQuery("select * from new_kind order by kindid");
//for show the newsinfo
PreparedStatement ps=con.prepareStatement("select * from news where newsid=?");
ps.setString(1,newsid);
ResultSet rs=ps.executeQuery();
while(rs.next()){
title=rs.getString("title")+"";
content=rs.getString("content")+"";
ispub=rs.getString("ispub")+"";
kind=rs.getString("kind")+"";
}
%>
<form action="updatenewsproc.jsp" method="post" enctype="multipart/form-data" name="form1">
<table width="542" height="418" border="0" align="center">
<tr>
<td width="43" height="28">标题</td>
<td width="489"><input name="title" type="text" id="title" size="50" value=<%=title%>></td>
</tr>
<tr>
<td height="24">分类</td>
<td><select name="kind" size="1" id="kind">
<%
while(rs2.next()){
%>
<option value="<%=rs2.getString("kindID")%>" <%=((kind.trim()).equals(rs2.getString("kindID"))?"selected=selected":"")%>><%=rs2.getString("kindname")%></option>
<%
}
%>
</select> </td>
</tr>
<tr>
<td height="165" valign="top">内容</td>
<td align="left" valign="top"><textarea name="content" cols="50" rows="10"><%=content%></textarea></td>
</tr>
<tr>
<td height="66"> </td>
<td>
<span class="STYLE8">
<% int i=1;
while(rs4.next()){
%>
<%=i++==1?"相关附件:":""%> </span>
<table width="489" border="0" style="border-bottom-style:dotted " >
<tr>
<td height="20" style="border-left-style:double"><span class="STYLE7"><%=rs4.getString("filename1")%>[<a href="javascript:check(<%=rs4.getString("nfid")%>)">删除</a>]</span></td>
</tr>
</table>
<%
}
%> </td>
</tr>
<tr>
<td height="34"> </td>
<td><table width="51%" height="34" border="0" id="tb">
<tr>
<td width="50%"><input name="file" type="file" size="29"></td>
</tr>
<tr> </tr><td>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="16"> </td>
<td><a href="javascript:addRow()" class="STYLE2 STYLE5">再来一个 </a>(<span class="STYLE10">上传格式≠bat,jsp,htm,exe (总大小<20M) </span>) </td>
</tr>
<tr>
<td height="24"> </td>
<td><select name="ispub">
<option value="0" <%=ispub.equals("0")?"selected=selected":""%>>不发表</option>
<option value="1" <%=ispub.equals("1")?"selected=selected":""%>>发表</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%
con.close();
%>
<script type="text/javascript">
function addRow(){
var newTr = tb.insertRow();
var newTd0 = newTr.insertCell();
//var newTd1 = newTr.insertCell();
newTd0.innerHTML = '<input type="file" name="file" size="29">';
//newTd1.innerText= '';
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -