import java.io.*; import java.util.*; import javax.servlet.*; public class HelloWorldServlet? extends GenericServlet? { static String initName; static String initAge; public void init(ServletConfig? sc) throws ServletException? { super.init(sc); initName=sc.getInitParameter("name"); initAge=sc.getInitParameter("age"); } public void service(ServletRequest? req, ServletResponse? res) throws ServletException?, IOException { PrintWriter? toClient=res.getWriter(); String name=req.getParameter("name"); String age=req.getParameter("age"); toClient.println("Welcome to HelloWorldServlet?."); toClient.println("Your name is "+(name!=null ? name : initName)); toClient.println("You're "+(age!=null ? age : initAge)+"years old"); toClient.close(); } }