package com.action;
import java.io.IOException;
import java.util.List;
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.SystemBean;
import com.bean.productClassBean;
import com.util.Constant;
import com.util.Filter;
import com.util.SmartFile;
import com.util.SmartUpload;
public class ProductClassServlet extends HttpServlet {
private ServletConfig config;
/**
* Constructor of the object.
*/
public ProductClassServlet() {
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();
String method = null;
productClassBean tb = new productClassBean();
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("delproductclass")) {
String id = mySmartUpload.getRequest().getParameter("id").trim();
// String id=request.getParameter("id").trim();
int flag = tb.delproductclass(id);
if (flag == Constant.SUCCESS) {
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
} else {
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
}
} else if (method.equals("addproductclass")) {// 增加
String title = mySmartUpload.getRequest().getParameter("title").trim();
int flag = tb.addproductclass(title);
if (flag == Constant.SUCCESS) {
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
} else {
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
}
}
// update
else if (method.equals("upproductclass")) {
String id = mySmartUpload.getRequest().getParameter("id").trim();
String title = mySmartUpload.getRequest().getParameter("title").trim();
int flag = tb.updateproductclass(Integer.parseInt(id), title);
if (flag == Constant.SUCCESS) {
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
} else {
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/productclass/index.jsp").forward(request, response);
}
}
} catch (Exception ex) {
ex.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
}
}
功能:普通用户:登陆,注册,账号信息管理,教师个人信息管理;
科研项目管理,包括科研项目总览,科研项目申请,科研项目查询;
科研成果管理,包括科研成果总览,科研成果申报,科研成果查询;
学术活动管理,包括学术活动总览,学术活动申请,学术活动查询;
文件信息查看,查看/查询管理员发布的通知,文件;
后台管理员;登陆,账号信息管理;
科研项目管理,包括科研项目总览(删除,修改),科研项目查询;
科研成果管理,包括科研成果总览(删除,修改),科研成果查询;
学术活动管理,包括学术活动总览(删除,修改),学术活动查询;
发布通知,文件;