import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet extends HttpServlet {
private String dbName="";
private String dbPassword="";
public void init(ServletConfig config) throws ServletException {
super.init(config);
ServletContext context = getServletContext();
dbName = context.getInitParameter("name");
dbPassword = context.getInitParameter("password");
}
public void doGet (HttpServletRequest req, HttpServletResponse res) throws IOException
{
ServletOutputStream out = res.getOutputStream();
res.setContentType("text/html");
out.println("Basic Servlet ");
out.println("Database username is " + dbName);
out.println("
Database password is " + dbPassword + "");
out.println("");
}
}
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
name
John
password
password
MyServletName
MyServlet
MyServletName
/index.html