📄 helloworldservlet.java
字号:
package com.test.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorldServlet extends HttpServlet {
public void init() throws ServletException {
// TODO Auto-generated method stub
super.init();
}
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req, res);
}
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String username = req.getParameter("username");
String password = req.getParameter("password");
res.setCharacterEncoding("gb2312");
PrintWriter pw = res.getWriter();
pw.println("<html><head><title></title></head>");
pw.println("<body><form></form></body></html>");
}
public void destroy() {
// TODO Auto-generated method stub
super.destroy();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -