📄 bulletin.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*" %>
<jsp:useBean id="data" scope="page" class="shop.data.conn" />
<style type="text/css">
<!-- @import url(../images/css.css); -->
</style>
<script language="JavaScript">
function check()
{
if(document.thisbulletin.setbulletin.value.length==0)
{
alert("请填写公告内容");
document.thisbulletin.setbulletin.focus();
return false;
}
}
</script>
<%
String admin=(String)session.getValue("admin");
if(admin=="" || admin==null)
{%>
<script language="javascript">
alert("请登陆后再执行管理操作");
self.location="index.jsp";
</script>
<%}else{
String sql="select * from admin where admin='"+admin+"'";
ResultSet rs=data.executeQuery(sql);
if(!rs.next())
{%>
<script language="javascript">
alert("对不起,无此管理员帐号");
history.back();
</script>
<%}}%>
<%
String sql="select * from shopother";
ResultSet rs=data.executeQuery(sql);
if(rs.next())
{
String bulletin=rs.getString("bulletin").trim();
%>
<form action="" method="post" name="thisbulletin" onSubmit="return check()">
<input type="hidden" name="upthis" value="">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="25" bgcolor="3969A5"><div align="center"><font color="#FFFFFF">公告设置</font></div></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="10"></td>
</tr>
<tr>
<td><div align="center"><textarea name="setbulletin" cols="40" rows="10" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"><%=bulletin%></textarea></div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="25"><div align="center">
<input type="submit" value="设置" onClick="document.all.upthis.value='true';" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
<input type="reset" value="复位" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"></div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="25" bgcolor="3969A5"></td>
</tr>
</table>
</form>
<%}%>
<%
String upthis=request.getParameter("upthis");
if(upthis!=null && upthis.equals("true"))
{
String setbulletin=request.getParameter("setbulletin");
setbulletin=new String(setbulletin.getBytes("ISO8859_1"),"GBK");
sql="update shopother set bulletin='"+setbulletin+"'";
rs=data.executeQuery(sql);
response.sendRedirect("bulletin.jsp");
}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -