blob: 6cf892fe35e554d408090777404349830b74b448 [file] [log] [blame]
package example;
import java.util.List;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class AddAction extends GuestbookAction {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
GuestbookEntryForm f = (GuestbookEntryForm) form;
List guestbook = getGuestbook();
synchronized (guestbook) {
guestbook.add(0, new GuestbookEntry(
f.getName(), f.getEmail(), f.getMessage()));
}
return mapping.findForward("success");
}
}