📄 updateservlet.java
字号:
package library;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.*;
public class UpdateServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
BookInfo bookInfo;
AuthorInfo authorInfo;
BookModel bookModel;
public void init(ServletConfig config) throws ServletException {
super.init(config);
bookModel = new BookModel();
}
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {response.setContentType(CONTENT_TYPE);
request.setCharacterEncoding("gb2312");
String bookNum = request.getParameter("bookNum");
String bookName = request.getParameter("bookName");
String authorNum = request.getParameter("authorNum");
String press = request.getParameter("press");
String authorName = request.getParameter("authorName");
String address = request.getParameter("address");
String email = request.getParameter("email");
String tel = request.getParameter("tel");
bookInfo = new BookInfo(bookNum,bookName,authorNum,press);
authorInfo = new AuthorInfo(authorNum,authorName,address,email,tel);
System.out.println(authorName);
bookModel.IsUpdateBook(bookInfo,authorInfo);
// request.setAttribute("crs1",bookInfo);
//request.setAttribute("crs2",authorInfo);
request.setAttribute("rs",bookModel.Query());
getServletContext().getRequestDispatcher("/Login_success.jsp").forward(request,response);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException{
doPost(request,response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -