📄 bulletinadd.jsp
字号:
<%--
模块名称:公告管理
模块功能:公告增加
版 本:V1.0
著 作 人:蔡静
著作日期:2001-11-12
使用说明:
主要技术说明:
参考文献:法律事务设计书
修改历史:= = = = = = = = = = = = = = = = = = = = = = = = = =
修改日期:2001-12-28
修 改 人:Celts
修改理由:运行期错误+内容长度限制
修改出处:
= = = = = = = = = = = = = = = = = = = = = = = = = =
--%>
<%@ page contentType= "text/html; charset=gb2312" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page import="system.*" %>
<jsp:useBean id="db" class="dbconnection.DbConnection" scope="page" />
<%
Security auth = new Security();
String employee_id = (String)session.getAttribute("employee_id");
if(employee_id == null || employee_id.equals(""))
{
response.sendRedirect(response.encodeRedirectURL("../Error/nonlogin.htm"));
}
String modelid = "Bbs020";
int authflag = auth.popedom(employee_id, modelid);
if(authflag == 0 || authflag == 2 || authflag == -1)
{
%>
<jsp:forward page="../inc/noauth.jsp" >
</jsp:forward>
<%
}
%>
<%
GetID gid = new GetID();
ExtendString es = new ExtendString();
String ggid = "GG" + es.digitToString(gid.getIDNumber("bbs_id")+1);
String str = request.getParameter("save");
if (str!=null) {
String bulletin_id, bulletin_title, bulletin_content;
String input_time, input_person;
bulletin_id = request.getParameter("bulletin_id");
bulletin_title = es.getStr(request.getParameter("bulletin_title"));
bulletin_content = es.getStr(request.getParameter("bulletin_content"));
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd");
input_time = f.format(d);
input_person = employee_id;
String sql = "insert into t_bulletin(bulletin_id, bulletin_title, bulletin_content,";
sql = sql + "input_time, input_person) values ('" + bulletin_id + "','";
sql = sql + bulletin_title + "','" + bulletin_content + "','" + input_time;
sql = sql + "','" + input_person + "')";
int num = db.executeUpdate(sql);
if (num <= 0) {%>
<script language="javascript">
alert("新增失败!");
</script>
<%}else {
gid.setIDNumber("bbs_id", gid.getIDNumber("bbs_id")+1);
ggid = "GG" + es.digitToString(gid.getIDNumber("bbs_id")+1);
}
}
%>
<html>
<head>
<title>公告增加</title>
<%@ include file="../inc/config.jsp" %>
</head>
<body class=page>
<script language="javascript">
function checkForm() {
if(document.form1.bulletin_title.value == "" ) {
alert("请输入公告标题!")
document.form1.bulletin_title.focus();
return false;
}
if(document.form1.bulletin_content.value == "" ) {
alert("请输入公告内容!")
document.form1.bulletin_content.focus();
return false;
}
if(document.form1.bulletin_content.value.length>200){
alert("输入公告内容不能超过200字!")
document.form1.bulletin_content.focus();
return false;
}
return true;
}
</script>
<!--显示工具条-->
<table width="98%" align="center" cellspacing="1">
<tr>
<td><a href="BulletinManage.jsp"><img src="../images/all.gif" height="22" border="0"></a>
<a href="BulletinAdd.jsp"><img src="../images/add.gif" alt="增加内容" width="79" height="22" border="0"></a>
<img src="../images/delete.gif" alt="删除选中的内容" width="79" height="22">
<a href="BulletinManageSearch.jsp"><img src="../images/query.gif" alt="查询内容" width="79" height="22" border="0"></a></td>
<td align="right"><img src="../images/back.gif" width="50" height="22" onClick="window.history.back()" style="cursor:hand" alt="返回"></td>
</tr>
</table>
<table width="98%" background="../images/line.gif" border="0" cellspacing="0" cellpadding="0" height="12" align="center">
<tr>
<td> </td>
</tr>
</table>
<!--显示工具条结束-->
<form name="form1" method="post" action="BulletinAdd.jsp">
<table width="98%" border="0" cellspacing="1" cellpadding="5" class="table_bg" align="center">
<tr>
<td width="21%" class="title_bg" align="right"> 公告编号:</td>
<td width="79%" class="tr_bg1">
<input type="text" name="bulletin_id" size="14" class="input" value=<%=ggid%> readOnly>
</td>
</tr>
<tr>
<td width="21%" class="title_bg" height="9" align="right"> 公告标题:</td>
<td width="79%" class="tr_bg1" height="9">
<input type="text" name="bulletin_title" size="70" class="input">
</td>
</tr>
<tr>
<td width="21%" class="title_bg" align="right"> 公告内容:</td>
<td width="79%" class="tr_bg1">
<textarea name="bulletin_content" rows="15" cols="70" class="input" maxlength="5"></textarea>
</td>
</tr>
</table>
<div align="center">
<input type="submit" name="save" value="保存" class="button" onClick="return checkForm()">
<input type="reset" name="reset" value="重写" class="button">
</div>
</form>
<script language="javascript">
document.form1.bulletin_title.focus();
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -