import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class WebAppProperties extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
ServletContext context = getServletContext();
String displayName = context.getServletContextName();
if (displayName == null) {
displayName = "(no display-name element defined)";
}
out.println("");
out.println("");
out.println("Web Application Properties");
out.println(" ");
out.println("");
out.println("Web Application Properties");
out.println("
Name: " + displayName);
out.println("
Context: " + req.getContextPath());
out.println("");
out.println("Initialization Parameters
");
out.println("
");
out.println("");
Enumeration e = context.getInitParameterNames();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
out.println("");
out.println("" + name + " ");
out.println("" + context.getInitParameter(name) + " ");
out.println(" ");
}
out.println("
");
out.println("");
out.println("");
out.flush();
}
}