📄 note_add.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GB18030" import="java.sql.*,java.util.Date,java.io.*"%>
<%@ include file="config.ini"%>
<%@ include file="conn.jsp"%>
<%@ include file="readlogin.jsp"%>
<%
String action=request.getParameter("action");
if(action==null) {action="";}
if(action.equals("save"))
{
String title=codeToString(request.getParameter("title"));
String content=codeToString(request.getParameter("content"));
java.text.SimpleDateFormat now=new java.text.SimpleDateFormat("yyyy-MM-dd");
String date=now.format(new java.util.Date());
try
{
sqlstr="insert into note1([user],[title],[content],[date]) values('"+iCan+"','"+title+"','"+content+"','"+date+"')";
iCanDb.doAdd(sqlstr);
out.print("<script>");
out.print("alert('添加成功!');");
out.print("location.href='note.jsp';");
out.print("</script>");
}
catch(Exception e)
{
out.print("<script>");
out.print("alert('数据库错误!');");
out.print("location.href='note.jsp';");
out.print("</script>");
}
}
%>
<html>
<head>
<%@ include file="head.jsp"%>
</head>
<script language="javascript">
function on_submit()
{//验证数据的合法性
if (form1.title.value == "")
{
alert("标题不能为空");
form1.title.focus();
return false;
}
if (form1.content.value == "")
{
alert("内容不能为空");
form1.content.focus();
return false;
}
}
</script>
<body>
<center>
<table border="0" width="768" id="table1" cellspacing="0" cellpadding="0">
<tr>
<%@ include file="top.jsp"%>
</tr>
<tr>
<td width="90" valign="top">
<%@ include file="menu.jsp"%> </td>
<td width="588" valign="top">
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="1" width="100%" id="table4" bordercolorlight="#0A9EE4" cellspacing="0" cellpadding="5" bordercolordark="#0A9EE4" height=300>
<tr>
<td valign="top">
<table border="0" width="100%" id="table5" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" id="table6" cellspacing="0" cellpadding="0">
<tr>
<td valign="bottom" width="50%">
</td>
<td width="50%">
<img src="images/n-note.jpg" align="right" width="230" height="70"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><hr noshade color="#0A9EE4" size="1"></td>
</tr>
<tr>
<td>
<form method="POST" action="note_add.jsp?action=save" target=_top name="form1" onsubmit="return on_submit()">
<table border="0" width="574" id="table7" cellspacing="0" cellpadding="5">
<tr>
<td width="104" height="40" align="center">
<p>
<font color="#0A9EE4">
<span style="font-size: 9pt; font-weight:700">
标题:</span></font></td>
<td width="450" height="40">
<p align="center">
<span style="font-size: 9pt">
<input type="text" name="title" size="51" style="border: 1px solid #0A9EE4"></span></td>
</tr>
<tr>
<td width="104" align="center">
<font color="#0A9EE4">
<span style="font-size: 9pt; font-weight:700">
内容:</span></font></td>
<td width="450">
<p align="center">
<span style="font-size: 9pt">
<textarea rows="21" name="content" cols="49" style="border: 1px solid #0A9EE4"></textarea></span></td>
</tr>
<tr>
<td width="574" colspan="2"> </td>
</tr>
<tr>
<td width="574" colspan="2">
<p align="center"><input type="submit" value="提交" name="B1" style="border: 1px solid #156FC7">
<input type="button" value="返回" name="B2" style="border: 1px solid #156FC7" onclick="javascript:location.href='list.jsp';"></td>
</tr>
</table></form>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="90"> </td>
</tr>
<tr>
<td width="90" valign="top">
</td>
<td width="588" valign="top">
<%@ include file="copyright.jsp"%>
</td>
<td width="90"> </td>
</tr>
</table>
<p>
</center>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -