在Servlet中所有初始化代码放在哪个函数中

来源:百度知道 编辑:UC知道 时间:2024/06/14 01:04:00

使用方法:init() ;使用此方法,必须在web.xml中对此servlet进行初始化参数设置;例如:在servlet中写如下代码:public init() throws ServletException{String test = getInitParameter("str")} ,其中str这个变量,是在web.xml中设置的。