• 博客(0)
  • 资源 (2)

空空如也

Java.Web开发详解源代码

Java.Web开发详解.书中例子的源代码 public class GuestbookException extends Exception { public GuestbookException(String msg) { super(msg); } }

2010-02-09

250个Java实例源代码

250个Java实例源代码 public class Hello extends HttpServlet { // This method is invoked when the servlet is the subject of an HTTP GET public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { // See if the username is specified in the request String name = request.getParameter("username"); // If not, look in the session object. The web server or servlet // container performs session tracking automatically for the servlet, // and associates a HttpSession object with each session. if (name == null) name = (String)request.getSession().getAttribute("username"); // If the username is not found in either place, use a default name. if (name == null) name = "World"; // Specify the type of output we produce. If this servlet is // included from within another servlet or JSP page, this setting // will be ignored. response.setContentType("text/html"); // Get an stream that we can write the output to PrintWriter out = response.getWriter(); // And, finally, do our output. out.println("Hello " + name + "!"); } // This method is invoked when the servlet is the subject of an HTTP POST. // It calls the doGet() method so that this servlet works correctly // with either type of request. public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException { doGet(request, response); } }

2010-02-09

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除