1.从用户角度来看:
用户通过在线注册成为网站的用户,可以获得以下功能:查看预约,修改预约,修改密码,修改个人信息。另外,用户注册成功后,可以进入到网站的留言板块进行留言等。
2.从网站的角度看:
(1)网站应该包含教室搜索功能:按教室(模糊)查询。
(2)预约处理功能,确认预约方式
(3)管理员管理:
(4)教室浏览
2 |
adminlog 操作日志表 |
||
字段名称 |
自动增长 |
字段类型 |
说明 |
id |
- |
int |
编号 |
username |
- |
varchar |
用户名 |
password |
- |
varchar |
密码 |
logintime |
- |
datetime |
日期 |
loginip |
- |
varchar |
IP |
package com.action;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.bean.LouBean;
import com.bean.SystemBean;
import com.util.Constant;
import com.util.Filter;
import com.util.SmartFile;
import com.util.SmartUpload;
public class LouServlet extends HttpServlet {
private ServletConfig config;
/**
* Constructor of the object.
*/
public LouServlet() {
super();
}
final public void init(ServletConfig config) throws ServletException
{
this.config = config;
}
final public ServletConfig getServletConfig()
{
return config;
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
String sysdir = new SystemBean().getDir();
HttpSession session = request.getSession();
try{
String username2 = (String)session.getAttribute("user");
String method = null;
LouBean louBean = new LouBean();
SmartUpload mySmartUpload = new SmartUpload();//init
int count = 0;
try{
mySmartUpload.initialize(config,request,response);
mySmartUpload.upload();
method = mySmartUpload.getRequest().getParameter("method").trim();
if(method.equals("addlou")){
String name = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("name").trim());
String beiyong1 = "";
String beiyong2 = "";
String beiyong3 = "";
String shijian = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("shijian").trim());
String beiyong4 = "";
String jianjie = mySmartUpload.getRequest().getParameter("jianjie");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/lou";
count = mySmartUpload.save(path);
if(file.getFilePathName().trim().equals("")){//如果无缩略图
int flag = louBean.addLou(name,beiyong1, beiyong2, beiyong3,shijian,"无",jianjie,beiyong4);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "增加教学楼成功!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
}
else{
int flag = louBean.addLou(name,beiyong1, beiyong2, beiyong3,shijian,path+"/"+file.getFileName(),jianjie,beiyong4);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "增加教学楼成功!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
}
//}
}
else if(method.equals("uplou")){
String id = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("id").trim());
String name = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("name").trim());
String shijian = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("shijian").trim());
String beiyong1 = "";
String beiyong2 = "";
String beiyong3 = "";
String beiyong4 = "";
String jianjie = mySmartUpload.getRequest().getParameter("jianjie");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/lou";
count = mySmartUpload.save(path);
if(file.getFilePathName().trim().equals("")){//如果不修改缩略图
int flag = louBean.updateLou(Integer.parseInt(id), name,beiyong1, beiyong2, beiyong3,shijian,jianjie,beiyong4);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "修改教学楼成功!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
}
else{//如果修改缩略图
int flag = louBean.updateLouWithPic(Integer.parseInt(id), name,beiyong1, beiyong2, beiyong3,shijian,path+"/"+file.getFileName(),jianjie,beiyong4);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "修改教学楼成功!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/lou/index.jsp").forward(request, response);
}
}
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception ex){
ex.printStackTrace();
request.getRequestDispatcher("error.jsp").forward(request, response);
}
//}
}catch(Exception e){
e.printStackTrace();
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}