// Copyright MageLang Institute; Version $Id: //depot/main/src/edu/modules/Servlets/magercises/ServletServiceTimeParameters/solution/ServletParameterTest.java#3 $ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; /** * ServletParametersTest servlet. This servlet will retrieve parameters * and use them to customize the output sent to the browser. * */ public class ServletParameterTest extends HttpServlet { public void doGet ( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException { // Variable to hold the two parameterss String paramName; String paramPosition; // Variable referencing the OutputStream sent back to the client ServletOutputStream out; // Add one line to // Set the Output Stream to HTML // Add two lines to // Get the name and position parameters from the client // Add one line to // Get a handle to the OutputStream going back to the client out.println(""); out.println("Parameter Test Servlet"); out.println(""); out.println("

Parameter Test Servlet

"); out.println("

"); out.println( paramName + ", I'm glad to see that you have achieved the position of " + paramPosition ); out.println("

"); out.println(""); out.println(""); out.close(); } public String getServletInfo() { return "A servlet that uses parameters to customize its output"; } }