Respond to an HTTP GET request.
// read the paremeters from the request
String first = request.getParameter(FIRST_PARAM);
String last = request.getParameter(LAST_PARAM);
String email = request.getParameter(EMAIL_PARAM);
// get the mailing list bean for this list
MailingBean mb = MailingBeanFactory.newInstance();
// set the parameters into the bean
mb.setFirst(first);
mb.setLast(last);
mb.setEmail(email);
// store a copy of the bean in the request context
request.setAttribute(MAILINGBEAN_ATTR, mb);
// perform the business method
boolean result = mb.doSubscribe();
// choose a page based on the result
String nextPage = "/success.jsp";
if (!result) nextPage = "/failure.jsp";
// transfer control to the selected view
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(nextPage);
dispatcher.forward(request, response);