GenericServlet: getInitParameterNames() : GenericServlet « javax.servlet « Java by API






GenericServlet: getInitParameterNames()

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class GetInitParams extends GenericServlet {

  public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();

    out.println("Init Parameters:");
    Enumeration e = getInitParameterNames();
    while (e.hasMoreElements()) {
      String name = (String) e.nextElement();
      out.println(name + ": " + getInitParameter(name));
    }
  }
}

           
       








Related examples in the same category

1.GenericServlet: getInitParameter(String arg0)
2.GenericServlet: init()
3.GenericServlet: getServletContext()
4.extends GenericServlet