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.yahoo.dba.perf.myperf.springmvc.HelpController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse resp)
        throws Exception {

    String key = req.getParameter("key");
    if (key == null || key.trim().length() == 0)
        key = "about";
    ModelAndView mv = new ModelAndView("help/" + key);
    return mv;/*from   w  w  w .  ja v a2 s  .c  o m*/

}

From source file:uta.ak.usttmp.console.controller.SettingController.java

@RequestMapping("/settings")
public ModelAndView settings() {

    ModelAndView mav = new ModelAndView("settings");
    return mav;
}

From source file:WebApp.Controller.LogoutController.java

@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    AuthenticationHelper.logout(request);
    ModelAndView modelAndView = new ModelAndView("index");
    return modelAndView;
}

From source file:controller.personaController.java

@Override
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
    ModelAndView mv = new ModelAndView("Persona");
    String out = "Datos Personales";
    try {//from   w  ww . j av  a2  s  . com
        /*Session sesion = HibernateUtil.getSessionFactory().openSession();
         sesion.beginTransaction();
         List result = sesion.createQuery(" from persona ").list();
         mv.addObject("Personas", result);
         sesion.getTransaction().commit();
         */
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        List result = session.createQuery("from Persona").list();
        mv.addObject("Personas", result);
        session.getTransaction().commit();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mv.addObject("message", out);
    return mv;
}

From source file:com.young.license.client.advice.LicenseAdvice.java

public Object checkLicense(ProceedingJoinPoint pj) throws Throwable {
    /**//from ww  w . ja  va2  s. c  om
     * ?license,?proceed,??
     */
    if (!LicenseTool.verify()) {
        System.out.println("License is expired ....redirect to [" + "redirect:" + Config.getExpirePage() + "]");
        return new ModelAndView("redirect:" + Config.getExpirePage());
    }
    return pj.proceed();
}

From source file:com.yahoo.dba.perf.myperf.springmvc.TermController.java

@Override
protected ModelAndView handleRequestImpl(HttpServletRequest req, HttpServletResponse resp) throws Exception {

    String[] names = req.getParameterValues("name");
    ModelAndView mv = new ModelAndView(jsonView);
    String res = "";
    for (String name : names) {
        if (name == null || name.isEmpty())
            continue;
        if (!name.startsWith("plan.")) {
            String desc = this.frameworkContext.getStatDefManager().getStatDescription(name);
            if (desc == null)
                desc = "no description found.";
            if (name != null && name.startsWith("mysql_status"))
                name = name.substring(13);
            if (res.length() > 0)
                res += "<br />";
            res += "<b>" + name + "</b>: " + desc;
        } else {/* www . j av a2  s  .  com*/
            String[] names2 = name.split(";");
            for (String name2 : names2) {
                if (name2 == null || "plan.extra.".equals(name2) || "plan.select_type.".equals(name2)
                        || "plan.join_type.".equals(name2))
                    continue;
                name2 = name2.trim();
                if (name.startsWith("plan.extra.") && !name2.startsWith("plan.extra."))
                    name2 = "plan.extra." + name2;
                if (name2.indexOf('(') >= 0)
                    name2 = name2.substring(0, name2.indexOf('('));
                else if (name2.startsWith("plan.extra.Cost"))
                    name2 = "plan.extra.Cost";
                String desc = this.frameworkContext.getStatDefManager().getStatDescription(name2);
                if (desc == null)
                    desc = "no description found.";
                if (res.length() > 0)
                    res += "<br />";
                res += "<b>" + name2.substring(5) + "</b>: " + desc;

            }
        }
    }

    mv.addObject("json_result", ResultListUtil.toJSONString(null, null, 0, res));
    return mv;
}

From source file:com.baron.bm.controller.ExceptionHandlerController.java

@ExceptionHandler(BindException.class)
public ModelAndView handleException(BindException error, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView("/common/backScript");
    mav.addObject("errorMessage", error.getFieldError().getDefaultMessage());
    return mav;//from ww w  . ja  v a2s. c  o  m
}

From source file:WebControllers.ControladorRaiz.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView index(HttpServletRequest request) {
    ModelAndView result = new ModelAndView("landing");
    /*    ModelAndView result = new ModelAndView("index");
        restaurante.setIdRestaurante(1);
        restaurante.setNombre("JFD");/*  www  . java 2 s .  c  o m*/
        result.addObject("holaMundo", "Hola mundo, si seor");*/
    return result;
}

From source file:com.healthcit.cacure.web.controller.CadsrLookupController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showForm() {

    //TODO
    return new ModelAndView("?????");
}

From source file:ru.mcdoker18.simulationdispatcher.controller.TestController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView test(HttpServletResponse response) throws IOException {
    return new ModelAndView("test");
}