📄 savearticle.jsp
字号:
<%@page contentType="text/html;charset=gb2312"%>
<%@ include file="../incoming/common.jsp"%>
<%@ include file="../incoming/connectdb.jsp"%>
<%@ include file="../incoming/codefilter.jsp"%>
<%@ include file="../incoming/check.jsp"%>
<html>
<head>
<meta HTTP-EQUIV=REFRESH CONTENT='4; URL=main.jsp'>
<title><%=title%>管理</title>
<link href="../incoming/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
try{
String newstitle = new String(request.getParameter("newstitle").getBytes("ISO8859_1"),"GBK");
String newsbody = new String(request.getParameter("newsbody").getBytes("ISO8859_1"),"GBK");
java.util.Date cur_time = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(cur_time);
String adduser=(String)session.getValue("username");
sql = "INSERT INTO article(TITLE,BODY,ADDDATE,ADDUSER) values(?,?,?,?)";
PreparedStatement prepstmt = null;
prepstmt=con.prepareStatement(sql);
prepstmt.setBytes(1,newstitle.getBytes("GB2312"));
prepstmt.setBytes(2,(toHtml(newsbody)).getBytes("GB2312"));
prepstmt.setBytes(3,dateString.getBytes("GB2312"));
prepstmt.setBytes(4,adduser.getBytes("GB2312"));
prepstmt.executeUpdate();
}
catch(Exception e){
out.println("错误信息:"+e.getMessage());
}
%>
<table width=381 border="1" align=center cellpadding=0 cellspacing=0 bordercolor="#CCCCCC">
<tr height=25>
<td width="391" align=center bgcolor="#999999"><font color=red><B>新闻发布成功</B></font></td>
</tr>
<tr class="text"><td align=center ><BR>
本页面将在<b><span id=last>3</span><a href=javascript:countDown></a></b>秒钟后自动返回管理页面,您可以选择以下操作:<BR>
<BR>
<a href="../index.jsp">返回新闻首页</a><br>
<a href='addarticle.jsp'>继续发布新闻</a> </TD>
</tr>
</table>
<script>
function
countDown(secs){last.innerText=secs;if(--secs>0)setTimeout("countDown("+secs+")",1000);}countDown(3);
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -