The import Tools. DBUtils;
The import com. Student;
The import javax.mail. Servlet. ServletException;
The import javax.mail. Servlet. HTTP. HttpServlet;
The import javax.mail. Servlet. HTTP. It;
The import javax.mail. Servlet. HTTP. HttpServletResponse;
import java.io.IOException;
Import the Java. SQL. SQLException;
import java.util.List;
Public class XiuGaiServlet extends the HttpServlet {
@ Override
Protected void doPost (it the req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
Student stu=new Student();
Stu. SetMingzi (the req. GetParameter (" mingzi "));
Stu. SetDizhi (the req. GetParameter (" dizhi "));
Stu. SetYuwen (the req. GetParameter (" yuwen "));
Stu. SetShuxue (the req. GetParameter (" shuxue "));
Stu. SetYingyu (the req. GetParameter (" yingyu "));
Try {
Boolean ok=new DBUtils (.) xiugai (stu);
If (ok) {
Resp. SendRedirect (" sousuo ");
}
{} the catch (SQLException throwables)
Throwables. PrintStackTrace ();
}
}
@ Override
Protected void doGet (it the req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String id=the req. GetParameter (" id ");
Try {
List
If (a list!=null) {
The req. SetAttribute (" xinxi ", a list);
The req. GetRequestDispatcher (" xiugai. JSP "). The forward (the req, resp);
} else {
The req. SetAttribute (" cuowu, "" no");
resp.setContentType("text/html; charset=utf-8");
The req. GetRequestDispatcher (" sousuo. JSP "). The forward (the req, resp);
}
{} the catch (SQLException throwables)
Throwables. PrintStackTrace ();
}
}
}
//form the following