servlet init 重写的例子

@Overwrite
public  void  init( )  throws  ServletException {
         // TODO Auto-generated method stub
         ServletConfig config =  this .getServletConfig();
         classname =  this .getInitParameter( "classname" );
         url =  this .getInitParameter( "url" );
         username =  this .getInitParameter( "username" );
         userpassword =  this .getInitParameter( "userpassword" );
         System.out.print(classname+ "  " +url+ "  " +username+ "  " +userpassword);
}

你可能感兴趣的:(servlet,init)