getpostdata.java

来自「j2ee编程技术中的一些代码」· Java 代码 · 共 52 行

JAVA
52
字号
/*
 * Created on 2004-6-13
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package com.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;

/**
 * @author haoyulong
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class getpostdata extends HttpServlet {
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		//TODO Method stub generated by Lomboz
		//为解决编码问题后来添加

		PrintWriter out = response.getWriter(); 
		out.println( //a tools method to show the html code with title 
		"<BODY BGCOLOR=\"#FDF5E6\">\n" + 
		"<H1 ALIGN=CENTER>" + "get post data " + "</H1>\n" + 
		"<UL>\n" + 
		" <LI><B>username</B>: " 
		+ request.getParameter("username") + "\n" + 
		" <LI><B>password</B>: " 
		+ request.getParameter("password") + "\n" + 
		"</UL>\n" + 
		"</BODY></HTML>"); 

	}
	
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		//TODO Method stub generated by Lomboz
		//为解决编码问题后来添加
        
	    doPost(request,response);

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?