package dk.hansen; import java.util.ArrayList; import java.util.Collection; import javax.servlet.http.*; import org.apache.log4j.Logger; import org.apache.struts.action.*; public final class ListVhsAction extends CommonVhsAction { private static Logger logger = Logger.getLogger(ListVhsAction.class.getName()); public ActionForward commonExecute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionErrors errors = new ActionErrors(); // Get the Vhs manager factory HttpSession session = request.getSession(); VhsManagerFactoryIF factory = (VhsManagerFactoryIF) session.getAttribute("vhsfactory"); VhsManagerIF manager = factory.createVhsManager(); Collection c = new ArrayList(); try { c = manager.getAll(); } catch (DAOException e) { // Message for the user: errors.add("label", new ActionError("error.listfailed")); saveErrors(request, errors); // Logging the error: String message = "Vhss could not be listed"; logger.fatal(message, e); // Save the chained exceptions: request.setAttribute("MYEXCEPTION", new DAOException(message, e)); // Return to the error page return (mapping.findForward("error")); } session.setAttribute("vhss", c); return (mapping.findForward("list")); } }