作者在 2011-08-19 11:23:03 发布以下内容
import javax.servlet.http.*;
import java.io.*;
public class TextDemo extends HttpServlet{
/**
*outPut方法
*String System 的用法
*/
public static void outPut(){
System.out.println("Input One Message");
String s="郑州国通交通设施有限公司";
String d ="网址:";
String v ="wwww.hnguotong.com";
String m = "Keywords:";
String value ="标牌厂家,路牌厂家,停车场设施";
System.out.println(s+d+v+m+value);
}
public void init() throws ServletException{
System.out.println("Intialiaze the www.hnguotong.com");
}
public void destory() throws ServletException{
System.out.println("Close the www.hnguotong.com");
}
/**
*用doPost 方法调用outPut方法
*看看有没有什么问题
*能不能把String 值显示到web页面上
*/
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
PrintWrite out = response.getWriter();
out.println(outPut);
out.flush();
out.close();
response.sendRedirect("www.hnguotong.com");
}
public void doGet(HttpServletRequest request,HttpServletResponse response)throws
ServletException,IOException{
this.doPost(request,response);
}
}