📄 addaffiche.java
字号:
package employee;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
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 database.*;
import bean.*;
public class Addaffiche extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
Affiche aff=new Affiche();
Date d = new Date();
String afftime=(1900+d.getYear())+"年"+(1+d.getMonth())+"月"+d.getDate()+"日";
aff.setAff_name(request.getParameter("aff_name"));
aff.setAff_body(request.getParameter("aff_body"));
aff.setAff_time(afftime);
new DB().addAffiche(aff);
HttpSession session = request.getSession();
session.setAttribute("addaffok", "ok");
response.sendRedirect("/software/affiche.jsp");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -