JavaWeb实验五(四),在Servlet中获取应用程序配置参数
发布时间
阅读量:
阅读量

1.该类的代码 代码有注释
注意:
- 声明变量initParam
- 对init方法进行重构
public void init(ServletConfig config) throws ServletException {
this.initParam = config.getInitParameter("url"); // 读取初始化参数
}
- 对doGet方法进行重新编写
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//System.out.println("初始化参数:" + this.initParam); // 输出初始化参数
response.setContentTy
全部评论 (0)
还没有任何评论哟~
