📄 edit.jsp
字号:
<%@ page errorPage="error.jsp" %>
<script language=javascript>
<!--
var startTime,endTime;
var d=new Date();
startTime=d.getTime();
//-->
</script>
<html><%
if (session.getAttribute("admin")==null || session.getAttribute("admin")==""){
response.sendRedirect("login.jsp");
} %>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page language="java" import="java.sql.*"%>
<jsp:useBean id="sqlbean" scope="page" class="news.sql_data"/>
<%@ page import="java.lang.*" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>企业内部管理信息平台-记录添加</title>
<link rel="stylesheet" href="m_style.css" type="text/css">
</head>
<body onload="initSel()">
<div align=center>
<SCRIPT LANGUAGE="JavaScript">
<%ResultSet rs = sqlbean.executeQuery("select * from class where parentid<>0");
int i=0;%>
var arrData=new Array();
<%while(rs.next()){
%>arrData[<%=i%>]=new Array("<%=rs.getString("parentclass")%>","<%=rs.getString("class")%>");
<%i++;}
rs.close();%>
function initSel() {
var optStr="";
for(var i=0;i<arrData.length;i++){
if(optStr.search("("+arrData[i][0]+")")<0){
optStr+="("+arrData[i][0]+")";
var oOptA=document.createElement("OPTION");
oOptA.value=arrData[i][0];
oOptA.innerHTML=arrData[i][0];
form1.selMain.appendChild(oOptA);
}
}
chgSlave();
}
function chgSlave(){
form1.selSlave.options.length=0;
for(var i=0;i<arrData.length;i++){
if(arrData[i][0]==form1.selMain.value){
var oOptB=document.createElement("OPTION");
oOptB.value=arrData[i][1];
oOptB.innerHTML=arrData[i][1];
form1.selSlave.appendChild(oOptB);
}
}
}
</SCRIPT>
<body>
<div>
<form name="form1" method="post" action="editupdate.jsp">
<%
String id,d,title,tempclass,news,dte,classname,sql,news2,tempclass2,author,file1,file2,file3;
id = request.getParameter("id");
int idd = Integer.parseInt(id);
//out.print(idd);
rs = sqlbean.executeQuery("Select * FROM news WHERE id = "+idd);
%>
<%
tempclass=null;
tempclass2=null;
news=null;
news2=null;
title=null;
dte=null;
author=null;
file1=null;
file2=null;
file3=null;
while(rs.next())
{
dte= (String)rs.getString("d");
file1= (String)rs.getString("file1");
file2= (String)rs.getString("file2");
file3= (String)rs.getString("file3");
title= (String)rs.getString("title");
news= (String)rs.getString("news");
tempclass= (String)rs.getString("class");
tempclass2=(String)rs.getString("parentclass");
//news2=new String(news.getBytes("GBK"),"ISO8859_1");
news2= new String(news.getBytes("ISO-8859-1"),"GBK");
author = rs.getString("author");
}
rs.close();
%>
<center>ID:<input name="id" TYPE=HIDDEN value='<%=id%>' size="5"><%=id%></center>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td width="15%" height="22" align="right" nowrap class="forumRowHighlight">一级分类:</td>
<td width="85%" class="forumRow"><%out.print(tempclass2);%> 可改为:
<select id="selMain" onchange="chgSlave()" name="selMain"></select>
</td>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight"><span class="forumRow">二级分类:</span></td>
<td class="forumRow"><%out.print(tempclass);%> 可改为:
<select id="selSlave" name="selSlave">
</select></td>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight">标题:</td>
<td class="forumRow"><font color="navy" face="Arial">
<input name="title" size="37" value="<%=title%>">
</font>
</td>
</tr><tr>
<td height="22" align="right" class="forumRowHighlight">文件一:</td>
<td class="forumRow"><input name="file1" type="text" id="file1" value="<%=file1%>" size="30">
<font color="#808080"> </font></td>
</tr><tr>
<td height="22" align="right" class="forumRowHighlight">文件二:</td>
<td class="forumRow"><input name="file2" type="text" id="file2" value="<%=file2%>" size="30">
<font color="#808080"> </font></td>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight">文件三:</td>
<td class="forumRow"><input name="file3" type="text" id="file3" value="<%=file3%>" size="30">
<font color="#808080"> </font></td>
</tr>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight">出处:</td>
<td class="forumRow"><input name="author" type="text" id="author" value="<%=author%>" size="25">
</td>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight">内容:</td>
<td class="forumRow" align="left"><textarea name="news" cols="70" rows="10" wrap="VIRTUAL" id="news"><%=news2%></textarea> </td>
</tr>
<tr>
<td colspan="2" id="upid" class="forumRow"> </td></tr>
</tr>
<tr>
<td height="22" align="right" class="forumRowHighlight"> </td>
<td align="left" class="forumRow">
<input type=Submit class=button value="提 交" name=Submit>
<input type=reset name=Submit2 class=button value="清 除">
</td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -