📄 post.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%//判断用户是否已经登录;如果还没有登录,则页面会直接导向登录界面;
//在实际的开发中,还应该判断登录的用户是否具有执行发布新的商品的权限;
//也就是说,只有具有相应的权限的用户,才可以进行下面的操作;
if ((session.getAttribute("username") == null)
|| (!session.getAttribute("username").equals("wangxining"))) {
response.sendRedirect("/ECommerce/member/login.jsp?url="
+ request.getRequestURI());
}
%>
<%@ include file="../include/header.jsp"%>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=760 align="center">
<TBODY>
<tr>
<td align="left" height=25><%if (session.getAttribute("username") != null) {
out.println(session.getAttribute("username"));
}%> 当前位置:<a href="/ECommerce/index.jsp">首页</a> -> <a href="/ECommerce/admin/index.jsp">后台管理</a> -> 发布商品</td>
<%@ include file="../include/date.jsp"%>
</tr>
<TR bgColor=#3399ff>
<TD height=1 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></TD>
</TR>
<tr>
<td height=10 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></td>
</tr>
</TBODY>
</TABLE>
<table align="center" border="0" width="760" cellspacing="0"
cellpadding="0" height="355">
<tr>
<td width="150" height="355" valign="top"><%@ include
file="../include/top_banner.jsp"%></td>
<td width="10" height="100%"></td>
<td width="1" height="100%" bgcolor="#3399ff"></td>
<td width="10" height="100%"></td>
<td width="589" height="331" valign="top" background="images/bg1.gif">
<table border="0" width="100%" cellspacing="0" cellpadding="0"
height="307">
<tr>
<td width="100%" height="20" bgcolor="#3399ff"> <font
color="#ffffff">发布</font></td>
</tr>
<tr>
<td>
<form name="form1" method="post" action="/ECommerce/ComposeServlet">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" height="20"></td>
</tr>
<tr>
<td align="right" width="150" valign="top">说明:</td>
<td width="20"> </td>
<td width="420">
<ul type="square">
<li>不支持HTML,请用文本格式。所有输入的HTML标记,都会被还原!</li>
<li>全部内容必须填</li>
</ul>
</td>
</tr>
<tr>
<td align="right" width="150">书名:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="name" size="50" value=""></td>
</tr>
<tr>
<td align="right" width="150">作者:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="author" size="50"
value=""></td>
</tr>
<tr>
<td align="right" width="150">语言:</td>
<td width="20">*</td>
<td width="420"><input type="radio" name="language" value="中文"
checked>中文 <input type="radio" name="language" value="英文">英文 </td>
</tr>
<tr>
<td align="right" width="150">类别:</td>
<td width="20">*</td>
<td width="420"><input type="radio" name="category" value="1"
checked>计算机类 <input type="radio" name="category" value="2">英语类 <input
type="radio" name="category" value="3">其他类 </td>
</tr>
<tr>
<td align="right" valign="top" width="150">内容简介:</td>
<td width="20" valign="top">*</td>
<td><textarea name="content" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td align="right" width="150">推荐程度:</td>
<td width="20">*</td>
<td width="420"><input type="radio" name="commend" value="1">好 <input
type="radio" name="commend" value="2">较好 <input type="radio"
name="commend" value="3" checked>一般 <input type="radio"
name="commend" value="4">较差 <input type="radio" name="commend"
value="5">差 </td>
</tr>
<tr>
<td align="right" width="150">出版社名称:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="publish_name" size="50"
value=""></td>
</tr>
<tr>
<td align="right" width="150">出版社地址:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="publish_address"
size="50" value=""></td>
</tr>
<tr>
<td align="right" width="150">是否配有光盘:</td>
<td width="20">*</td>
<td width="420"><input type="radio" name="cdrom" value="1" checked>有
<input type="radio" name="cdrom" value="0">没有 </td>
</tr>
<tr>
<td align="right" width="150">价格:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="price1" size="4" value="">元
<input type="text" name="price2" size="4" value="">角 </td>
</tr>
<tr>
<td align="right" width="150">是否是特价书:</td>
<td width="20">*</td>
<td width="420"><input type="radio" name="good_price" value="1"
checked>是 <input type="radio" name="good_price" value="0">否 </td>
</tr>
<tr>
<td align="right" width="150">库存量:</td>
<td width="20">*</td>
<td width="420"><input type="text" name="book_number" size="50"
value=""></td>
</tr>
<tr>
<td align="right"> </td>
<td width="20"> </td>
<td align="left"><input type="button" name="post" value="发 布"
onclick="sub()"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script language="javascript">
function sub()
{
if(document.form1.name.value=="")
{
window.alert("请输入书名!");
document.form1.name.focus();
return false;
}
if(document.form1.author.value=="")
{
window.alert("请输入作者姓名!");
document.form1.author.focus();
return false;
}
if(document.form1.content.value=="")
{
window.alert("请输入内容简介!");
document.form1.content.focus();
return false;
}
if(document.form1.publish_name.value=="")
{
window.alert("请输入出版社名称!");
document.form1.publish_name.focus();
return false;
}
if(document.form1.publish_address.value=="")
{
window.alert("请输入出版社地址!");
document.form1.publish_address.focus();
return false;
}
if(document.form1.price1.value=="")
{
window.alert("请输入价格!");
document.form1.price1.focus();
return false;
}
if(isNaN(parseInt(document.form1.price1.value))||document.form1.price1.value<0)
{
window.alert("请输入正确的价格!");
document.form1.price1.focus();
return false;
}
if(document.form1.price2.value=="")
{
window.alert("请输入价格!");
document.form1.price2.focus();
return false;
}
if(isNaN(parseInt(document.form1.price2.value))||document.form1.price2.value>9||document.form1.price2.value<0)
{
window.alert("请输入正确的价格!");
document.form1.price2.focus();
return false;
}
if(document.form1.book_number.value=="")
{
window.alert("请输入库存量!");
document.form1.book_number.focus();
return false;
}
if(isNaN(parseInt(document.form1.book_number.value))||document.form1.book_number.value<0)
{
window.alert("请输入正确的库存量!");
document.form1.book_number.focus();
return false;
}
document.form1.submit();
}
</script></td>
</tr>
</table>
<%@ include file="../include/footer.jsp"%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -