servlet_获取初始化参数

在web.xml的<servlet>标签中增添

<init-param>

  <param-name>XXX</param-name>

  <param-value>XXX</param-value>

</init-param>

 

public void init() throws ServletException {
  // Put your code here
  this.setUsername(this.getInitParameter("username"));
  this.setPassword(this.getInitParameter("password"));
}

 

posted on 2016-08-26 20:32  JASONlee3  阅读(258)  评论(0编辑  收藏  举报

导航