Java tutorial
/** * Fonti is a web application for billing and budgeting * Copyright (C) 2009 Carlos Fernandez * * This file is part of Fonti. * * Fonti is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fonti is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.carlos.projects.billing.ui.controllers; import com.carlos.projects.billing.dao.DocumentDAO; import com.carlos.projects.billing.domain.Document; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.ParameterizableViewController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; /** * Controller to show the document with all the components belonging to it * * @author Carlos Fernandez * @date 04-Apr-2012 */ public class DocumentController extends ParameterizableViewController { private DocumentDAO documentDAO; public DocumentController(DocumentDAO documentDAO) { super(); this.documentDAO = documentDAO; } @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); model.put("document", documentDAO.getById(Document.class, Long.parseLong(request.getParameter("documentId")))); return new ModelAndView(getViewName(), model); } }