Package org.dvdexchange.web

Source Code of org.dvdexchange.web.DvdLibraryController

package org.dvdexchange.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dvdexchange.domain.DvdCollection;
import org.dvdexchange.domain.User;
import org.dvdexchange.service.DvdLibrary;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class DvdLibraryController implements Controller {

    protected final Log logger = LogFactory.getLog(getClass());
    private DvdLibrary m_dvdLibrary;
   
    public void setDvdLibrary(DvdLibrary dvdLibrary) {
      m_dvdLibrary = dvdLibrary;
    }
   
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
      User user = (User) request.getSession().getAttribute("user");
      DvdCollection dvdList = m_dvdLibrary.getDvdsAvailableForUser(user);
      DvdCollection myDvds = m_dvdLibrary.getDvdsUserOwns(user);
        ModelAndView modelAndView = new ModelAndView("dvdLibrary");
        modelAndView.addObject("dvdList", dvdList);
        modelAndView.addObject("myDvds", myDvds);
    return modelAndView;
    }

}
TOP

Related Classes of org.dvdexchange.web.DvdLibraryController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.