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() 

Source Link

Document

Default constructor for bean-style usage: populating bean properties instead of passing in constructor arguments.

Usage

From source file:com.MyHistory.Controller.AdministratorController.java

@RequestMapping(value = "/FormularioAdministrador", method = RequestMethod.GET)
public ModelAndView desplegarFormularioAdministrador() {
    System.out.println("admin Controller method:GET");
    ModelAndView mv = new ModelAndView();
    mv.setViewName("FormularioAdministrador");
    return mv;// w w  w.j  av a  2s .com
}

From source file:ilearn.orb.controller.WelcomeController.java

@RequestMapping(value = "/")
public ModelAndView welcome(Locale locale,
        //@PathVariable("name") String name,
        HttpSession session) {//from   w w w .j av a  2  s. co  m

    ModelAndView model = new ModelAndView();
    model.setViewName("index");
    //model.addObject("name", name);

    return model;

}

From source file:org.openmrs.module.radiology.web.controller.RadiologyOrderListController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest() {
    ModelAndView mav = new ModelAndView();
    mav.setViewName("module/radiology/radiologyOrderList");
    return mav;/*from   w  ww.j a  v  a 2  s .  c  o m*/
}

From source file:com.MyHistory.Controller.JugadorController.java

@RequestMapping(value = "/FormularioJugador", method = RequestMethod.GET)
public ModelAndView desplegarFormularioJugador() {
    ModelAndView mv = new ModelAndView();
    ServiceJugador servicio = new ServiceJugador();
    ResponseRegisterJugador respuesta = servicio.obtenerDatosRegistroJugador();
    mv.addObject("respuesta", respuesta);
    mv.setViewName("FormularioJugador");
    return mv;//w w w  . j  a  v a  2 s  . c  o  m
}

From source file:nl.mok.mastersofcode.spectatorclient.controllers.TeamController.java

@RequestMapping(method = RequestMethod.GET, value = "/{username}")
public ModelAndView showTeam(final HttpServletRequest request, @PathVariable String username) {
    ModelAndView mav = new ModelAndView();

    mav.addObject("page", new Object() {
        public String uri = "/spec/team";
        public String redirect = request.getRequestURL().toString();
    });//from  w ww.  j av  a 2 s.  c  o m

    mav.addObject("team", DataController.getTeamById(username).orElse(null));
    mav.addObject("currentCompetition", DataController.getCurrentCompetition());
    mav.addObject("currentRound", DataController.getCurrentRound());

    mav.setViewName("team.twig");

    return mav;
}

From source file:nl.mok.mastersofcode.spectatorclient.controllers.CompetitionController.java

@RequestMapping(method = RequestMethod.GET, value = "/{id}")
public ModelAndView showCompetition(final HttpServletRequest request, @PathVariable int id) {

    ModelAndView mav = new ModelAndView();

    mav.addObject("page", new Object() {
        public String uri = "/spec/competition/" + id;
        public String redirect = request.getRequestURL().toString();
    });/*from   w  w w. j av  a2 s  .c o m*/

    mav.addObject("competition", DataController.getCompetitionById(id).orElse(null));
    mav.addObject("currentCompetition", DataController.getCurrentCompetition());
    mav.addObject("currentRound", DataController.getCurrentRound());

    mav.setViewName("competition.twig");

    return mav;
}

From source file:pl.lodz.uni.math.controller.HelloController.java

@RequestMapping(value = "/admin**", method = RequestMethod.GET)
public ModelAndView adminPage() {

    ModelAndView model = new ModelAndView();
    //model.addObject("title", "Spring Security Hello World");
    //model.addObject("message", "This is protected page!");
    model.setViewName("admin/admin");

    return model;

}

From source file:com.MyHistory.Controller.TorneoController.java

@RequestMapping(value = "/ListaTorneos", method = RequestMethod.GET)
public ModelAndView mostrarTorneos(HttpServletRequest pRequest) {
    ModelAndView mv = new ModelAndView();
    ServiceTorneo torneo_service = new ServiceTorneo();
    ResponseTorneos respuesta = torneo_service.getTorneos();
    mv.addObject("respuesta", respuesta);
    mv.setViewName("ListaTorneos");
    return mv;/*from  w  w  w .j  a v  a 2s.  c o  m*/
}

From source file:mx.um.edu.medicina.camposClinicos.webapp.PlazaController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest() throws Exception {
    return new ModelAndView().addObject(plazaManager.getAll());
}

From source file:com.geaviation.controller.LoginController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView mv = new ModelAndView();

    DataSource ds = (DataSource) this.getApplicationContext().getBean("myDataSource");

    try {//  w w w .j a v a 2s  .  co m

        String username = request.getParameter("username");
        String password = request.getParameter("password");
        //String status = "FAILURE";

        QueryRunner run = new QueryRunner(ds);
        ResultSetHandler<UsersBean> user = new BeanHandler<UsersBean>(UsersBean.class);
        Object[] params = new Object[2];
        params[0] = username;
        params[1] = password;
        UsersBean ub = run.query("select * from user_account where UNAME =? and UPASSWORD =?", user, params);
        if (ub != null) {

            mv.addObject("username", username);
            mv.setViewName("home");
        } else {
            mv.addObject("error", "true");
            mv.setViewName("index");

        }

    } catch (Exception e) {

        e.printStackTrace();
    }

    return mv;
}