post.jsp
来自「jsp的技术教程」· JSP 代码 · 共 132 行
JSP
132 行
<%@ include file="../book_store/head.inc"%>
<%if(session.getAttribute("username")==null){
response.sendRedirect("../member/login.jsp?url="+request.getRequestURI());
}
%>
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
<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="../index.jsp">首页</a> -> <a href="index.jsp">论坛</a> -> 发表新言论
</td>
<%@ include file="../member/date.inc"%>
</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">
</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>
<%!
//boolean loginAttempt = false;
//if (loginAttempt)
// {
// out.print("fds");
// }else out.println("1212");
%>
<form name="form1" method="post" action="post_ok.jsp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="3" height="20"></td></tr>
<tr>
<td align="right" width="120" valign="top">说明:</td>
<td width="20"> </td>
<td width="450">
<ul type="square">
<li>不支持HTML,请用文本格式。所有输入的HTML标记,都会被还原!</li>
</ul>
</td>
</tr>
<tr>
<td align="right">标题:</td>
<td width="20">*</td>
<td width="500">
<input type="text" name="title" size="64" value="">
</td>
</tr>
<tr>
<td align="right">作者:</td>
<td width="20">*</td>
<td width="500">
<input type="text" name="author" size="64" value="<%=session.getValue("username")%>" readonly>
</td>
</tr>
<tr>
<td align="right">作者的电子邮件:</td>
<td width="20"> </td>
<td width="500">
<input type="text" name="aemail" size="64" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">内容:</td>
<td width="20" valign="top">*</td>
<td>
<textarea name="content" cols="64" rows="8"></textarea>
</td>
</tr>
<tr>
<td align="right"> </td>
<td width="20"> </td>
<td align="right">
<input type="button" name="post" value="张贴" onclick="sub()">
</td>
</tr>
</table>
</form>
<%//}%>
</td>
</tr>
</table>
<script language="javascript">
function sub()
{
if(document.form1.title.value=="")
{
window.alert("请输入文章标题!");
document.form1.title.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;
}
document.form1.submit();
}
</script>
</td>
</tr>
</table>
<%@ include file="../member/footer.inc"%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?