昨天完成了主功能界面的美化
今天我的任务是实现了表单提交的一些小功能,比如不能为空等提示和表单美化
明天计划实现时间的显示等细节问题。
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:useBean id="db" class="com.jb.db.jdDB"/>
<html>
<head>
<title>捡到表单</title>
</head>
<%
request.setCharacterEncoding("UTF-8");
String mess="";
String name=request.getParameter("name");
String place=request.getParameter("place");
String time=request.getParameter("time");
String people=request.getParameter("people");
if(place==null||place==""){
place="未留此信息";
}
boolean mark=true;
if(mark){
String sql="insert into jd values('"+name+"','"+place+"','"+time+"','"+people+"')";
int i=db.insert(sql);
db.closed();
if(i>0)
{
out.print("<script>alert('Form submission was successful!');window.location.href='Maintest.jsp'</script>");
}
else
mess="插入失败!";
}
%>
<body>
<table>
<tr bgcolor="lightgrey">
<td>友情提示!</td>
</tr>
<tr>
<td align="center"><%=mess%></td>
</tr>
</table>
<a href="jiandao.jsp">[返回上一级]</a>
<a href="xuesheng.jsp">[返回学生界面]</a>
</body>
</html>