首页 > 其他 > 详细

hello2代码的简单分析

时间:2019-03-24 22:42:02      阅读:161      评论:0      收藏:0      [点我收藏+]

hello2部分代码:

  

  String username = request.getParameter("username");//将get~这个方法赋给username这个对象
  if (username != null && username.length() > 0) {
  RequestDispatcher dispatcher =getServletContext().getRequestDispatcher("/response");//定义接收来自客户端的请求并将它们发送到服务器上的任何资源的对象dispatcher
                                          //该对象被用作包装位于特定路径上的服务器资源或通过特定名称给定的服务器资源的包装器
       if (dispatcher != null) {
  dispatcher.include(request, response);
  }
  }
  out.println("</body></html>");//判dispatcher这个对象的值是否为空,并返回输出
  }
  }

  @Override// 伪代码,表示重写
  public String getServletInfo() {
  return "The Hello servlet says hello.";//返回hello最后的输出

  }
  }

 

hello2代码的简单分析

原文:https://www.cnblogs.com/zhuguohui/p/10590962.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!