Example usage for org.springframework.web.servlet ModelAndView ModelAndView

List of usage examples for org.springframework.web.servlet ModelAndView ModelAndView

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView ModelAndView.

Prototype

public ModelAndView(View view) 

Source Link

Document

Convenient constructor when there is no model data to expose.

Usage

From source file:com.technologicaloddity.saha.controller.IndexController.java

@RequestMapping("/index.html")
public ModelAndView handleRequest(Model model) {
    Metadata nameMetadata = metadataDao.getNameMetadata();

    ModelAndView modelAndView = new ModelAndView("index");
    modelAndView.addObject("nameMetadata", nameMetadata);
    return modelAndView;
}

From source file:org.fon.documentmanagementsystem.controllers.TipdokumentaController.java

@RequestMapping(path = "/overview", method = RequestMethod.GET)
public ModelAndView home() {
    ModelAndView mv = new ModelAndView("documenttype_overview");
    List<Tipdokumenta> sviTipoviDokumenata;
    sviTipoviDokumenata = tipDokumentaService.findAll();
    mv.addObject("documenttypes", sviTipoviDokumenata);
    return mv;/* w w  w. j ava2  s . c  om*/
}

From source file:com.fengduo.bee.web.controller.cms.CMSController.java

/**
 * /*w  ww .  j  a v a  2 s .c o m*/
 * 
 * @return
 */
@RequestMapping(value = "/help/{name}")
public ModelAndView help(@PathVariable("name") String name) {
    ModelAndView mav = new ModelAndView("cms/" + name);
    mav.addObject("name", name);
    return mav;
}

From source file:controller.book.java

@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {

    ModelAndView m = new ModelAndView("book");
    String docid = hsr.getParameter("search4");

    int subjectid = 0;
    if (docid != null && !docid.isEmpty())
        subjectid = Integer.parseInt(docid.trim());

    //String city = hsr.getParameter("doctordepartment");

    Session sessionx = HibernateUtil.getSessionFactory().getCurrentSession();
    sessionx.beginTransaction();//from   w  w w  .  j  a  v  a 2s .c om
    Query query = sessionx.createQuery("from Timings where id = :docid");
    //query.setParameter("doctordepartment", dep);
    //query.setParameter("city", city);
    query.setParameter("docid", subjectid);
    List list = query.list();
    //  if (list.size()==0){
    //     return new ModelAndView(new RedirectView("home.htm"));

    //  }
    m.addObject("book", list);
    m.getViewName();
    sessionx.getTransaction().commit();
    //return new ModelAndView(new RedirectView("home.htm"));

    return m;

}

From source file:com.webservlet.LoginServlet.java

@RequestMapping(method = { RequestMethod.POST })

public ModelAndView handleRequestInternal() {

    return new ModelAndView("home");
}

From source file:controller.logout.java

@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {

    ModelAndView m = new ModelAndView("logout");
    HttpSession session = hsr.getSession();
    session.removeAttribute("scard");
    // m.addObject("doctors", list);
    m.getViewName();/*w  w w .ja v a  2 s . com*/

    return new ModelAndView(new RedirectView("home.htm"));

}

From source file:com.griddynamics.banshun.web.AnnotatedTestController.java

@RequestMapping("/annotation-test.html")
public ModelAndView annotationTest() {
    String message = "Hello Spring MVC";

    ModelAndView modelAndView = new ModelAndView("testView");
    modelAndView.addObject("message", message);

    return modelAndView;
}

From source file:com.aerolinea.control.ControlIndex.java

@RequestMapping(value = "/", method = GET)
public ModelAndView mostrarIndex(@RequestParam("texto") String texto) {
    ModelAndView mv = new ModelAndView("index");
    mv.addObject("mensaje", "Hola 1 " + texto);
    return mv;//from ww w .ja va 2  s .  c  om
}

From source file:com.poscoict.license.web.controller.ExceptionControllerAdvice.java

public ModelAndView errView(Exception ex) {
    ex.printStackTrace();/*from  w  w w  .  jav a 2s.  com*/
    logger.error(ex.toString());
    ModelAndView mv = new ModelAndView(DEFAULT_ERROR_VIEW);
    mv.addObject("name", ex.getClass().getSimpleName());
    //mv.addObject("message", ex.getMessage());
    mv.addObject("message", "?");

    if (ex.getClass().getSimpleName().equals("BadSqlGrammarException")) {
        mv.addObject("message", "?? ? .  ? .");
    } else if (ex.getClass().getSimpleName().equals("MySQLSyntaxErrorException")) {
        mv.addObject("message", "?? ? .  ? .");
    } else if (ex.getClass().getSimpleName().equals("NullPointerException")) {
        mv.addObject("message", "?? ?. ?? ? .");
    } else if (ex.getClass().getSimpleName().equals("DuplicateKeyException")) {
        mv.addObject("message", "?  ?. ?? ? .");
    } else if (ex.getClass().getSimpleName().equals("SQLException")) {
        mv.addObject("message", "?? ? .  ? .");
    } else if (ex.getClass().getSimpleName().equals("MySQLIntegrityConstraintViolationException")) {
        mv.addObject("message", "?  ?. ?? ? .");
    } else if (ex.getClass().getSimpleName().equals("DataIntegrityViolationException")) {
        mv.addObject("message",
                "?  ?. ?? ? . ?  ? ? ? ?  .");
    } else if (ex.getClass().getSimpleName().equals("IOException")) {
        mv.addObject("message", "?");
    } else if (ex.getClass().getSimpleName().equals("Exception")) {
        mv.addObject("message", "ex.?");
    } else {
        mv.addObject("message", "?");
    }

    return mv;
}

From source file:com.googlecode.psiprobe.controllers.logs.SetupFollowController.java

protected ModelAndView handleLogFile(HttpServletRequest request, HttpServletResponse response,
        LogDestination logDest) throws Exception {
    File logFile = logDest.getFile();
    List sources = getLogResolver().getLogSources(logFile);
    return new ModelAndView(getViewName()).addObject("log", logDest).addObject("sources", sources);
}