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.opencnc.controllers.InicioController.java

@RequestMapping("/inicio/infcad")
public ModelAndView infcad() {
    ModelAndView m = new ModelAndView("/inicio/infcad");
    return m;
}

From source file:controladores.DatosUsuarioController.java

@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
    String nombreUsu = hsr.getParameter("txtNombre");
    String apellidosUsu = hsr.getParameter("txtApellidos");
    String edadUsu = hsr.getParameter("txtEdad");

    ModelAndView mv = new ModelAndView("DatosUsuario");
    String mensaje = "Datos de Usuario de la VISTA:";
    Usuario usu = new Usuario();
    if (nombreUsu != null) {
        mensaje = "Datos cambiados en VISTA a " + nombreUsu;
        usu.setNombre(nombreUsu);// w w w .  j  av  a  2 s . c o  m
        usu.setApellidos(apellidosUsu);
        usu.setEdad(Integer.parseInt(edadUsu));
    } else {
        usu.setNombre("Lucia");
        usu.setApellidos("Ramos");
        usu.setEdad(24);
    }

    mv.addObject("mensaje", mensaje);
    mv.addObject("usuario", usu);

    return mv;
}

From source file:bc8.movies.controllers.RegisterController.java

@RequestMapping("/validateRegister")
public ModelAndView registerUser(User user) {
    ModelAndView mv = new ModelAndView("home");

    if (!userService.checkUser(user)) {
        userService.addUser(user);/*ww  w . java2s. c  om*/
        mv.addObject("message", "Welcome " + user.getUsername());
    } else {
        mv.addObject("message", "Username already in use.");
    }

    return mv;
}

From source file:com.eftech.wood.controllers.ControllerTest.java

@RequestMapping(value = "/camera", method = RequestMethod.GET)
public ModelAndView userSorexInfo(HttpSession session) {
    ModelAndView mv = new ModelAndView("test");

    // List<Hmc> listHmc = hmcJDBCTemplate.listHmc();
    //// printInFile(listHmc.toString());
    camara.snap();/*  w  w  w. j a  v a2  s. c  om*/
    String str = camara.getSnap();

    mv.addObject("str", str);
    // session.setAttribute("page", "index");

    return mv;
}

From source file:controller.AutoController.java

@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
    ModelAndView mv = new ModelAndView("doctors");
    String out = "LoginDetails";
    try {/*from ww w  .  j  av  a2s  .c  om*/

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List result = session.createQuery("from Logintable").list();
        mv.addObject("logintables", result);
        session.getTransaction().commit();
    } catch (Exception e) {
        e.printStackTrace();

    }

    mv.addObject("message", out);
    return mv;
}

From source file:css.controller.AdmissionResultsFormController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest,
        HttpServletResponse httpServletResponse) throws Exception {
    return new ModelAndView("admissionresults");
}

From source file:app.springapp.HelloController.java

@RequestMapping("/hello")
public ModelAndView hello() throws ServletException, IOException {

    logger.info("Returning hello view");

    return new ModelAndView("hello");
}

From source file:com.freetest.test.controller.HomeAction.java

@RequestMapping(value = "/", method = { RequestMethod.GET })
public ModelAndView index() {
    ModelAndView mav = new ModelAndView("index");

    mav.addObject("user", "hello");
    return mav;//from w w w .  ja  v  a 2s .  com
}

From source file:com.intel.cosbench.controller.web.TimelinePageController.java

protected ModelAndView process(WorkloadInfo wInfo, StageInfo sInfo) {
    ModelAndView result = new ModelAndView("timeline");
    result.addObject("wInfo", wInfo);
    result.addObject("sInfo", sInfo);
    return result;
}

From source file:eventmanager.controller.RelatoriosController.java

@RequestMapping(value = "/User/relatorio")
public ModelAndView relatorio(HttpSession session) {
    ModelAndView modelAndView = new ModelAndView("relatorio");
    User user = (User) session.getAttribute("usuario_logado");
    ArrayList aux = new ArrayList();
    List<Event> eventoList = user.getMeusEventos();
    for (Event evento : eventoList) {
        aux.add(evento.getInscritos().size());
    }//w  ww  .  j a v  a  2s .com
    int qtd = 0;
    for (Object aux1 : aux) {
        qtd += (int) aux1;
    }
    List inscricaoList = user.getMinhasInscricoes();
    System.out.println(inscricaoList.size());
    modelAndView.addObject("quantidadeEventos", eventoList.size());
    modelAndView.addObject("quantidadeInscritos", inscricaoList.size());
    modelAndView.addObject("quantidadeInscritosMeusEventos", qtd);
    modelAndView.addObject("usuario", user.getNome());
    modelAndView.addObject("nomeEvento", new Busca());

    return RenderView.getInstance().renderRelatorioViewUser(user, modelAndView);
}