package cwp.tags; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class Servlet1 extends HttpServlet { private static final String CONTENT_TYPE = "text/html"; /**Initialize global variables*/ public void init(ServletConfig config) throws ServletException { super.init(config); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { //response.setContentType(CONTENT_TYPE); // The following gets the original value posted in the HTML form: String aString = request.getParameter("sample"); PrintWriter out = response.getWriter(); out.println("hello"); /* out.println(""); out.println("Servlet1"); out.println(""); // This shows the data from the post from choices.html out.println("

Servlet 1 has received a POST. This is the reply:

"); out.println("i am in servlet one"); out.println(aString); out.println(""); // This is an example of how to forward a post (in this case from choices.html to servlet2): RequestDispatcher rd = request.getRequestDispatcher("http://gallop.uccs.edu:8888/examples/servlet/cwp.tags.Servlet2"); rd.include(request, response); */ } /**Clean up resources*/ public void destroy() { } }