public class Form extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public Form() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html;charset=utf-8"); response.setCharacterEncoding("utf-8"); PrintWriter writer = response.getWriter(); StringBuffer buffer = new StringBuffer(); /* <form action=''> username:<input type='text'> password:<input type='text'> </form> */ buffer.append("<form action=''>"); buffer.append("username:<input type='text'>"); buffer.append("password:<input type='text'>"); buffer.append("</form>"); }}
添加回答
举报
0/150
提交
取消