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

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

Introduction

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

Prototype

public void setViewName(@Nullable String viewName) 

Source Link

Document

Set a view name for this ModelAndView, to be resolved by the DispatcherServlet via a ViewResolver.

Usage

From source file:com.ut.healthelink.controller.productSuiteController.java

/**
 * The '/doc-u-link' request will display the DOC-u-Link information page.
 *//*from   w w w.jav a 2s.c  o m*/
@RequestMapping(value = "/doc-u-link", method = RequestMethod.GET)
public ModelAndView doculink() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/doculink");
    mav.addObject("pageTitle", "DOC-u-Link");
    return mav;
}

From source file:Controller.MovieController.java

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String type = request.getParameter("type");
    ModelAndView mv = new ModelAndView();
    if (type.equals("map1")) {
        mv.setViewName("cancela");
    } else {/*from  w w w . j  a va 2s .c  o  m*/
        if (type.equals("map2")) {
            mv.setViewName("delay");
        } else {
            mv.setViewName("top30delay");
        }
    }

    return mv;

}

From source file:com.anthony.forumspring.controller.TopicController.java

@RequestMapping(value = "/createNewTopics", method = RequestMethod.POST)
public ModelAndView creatNewTopicView(@ModelAttribute Topics topics) {
    ModelAndView mav = new ModelAndView();

    mav.setViewName("createTopics");
    return mav;//  w w w  .  ja  v a2s  .c  om
}

From source file:controller.PackagesCustomer.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView packagesCustomer(Authentication authen) {
    ModelAndView model = new ModelAndView();
    model.setViewName("packagesCustomer");
    Customer cus = cusModel.find(authen.getName(), "username", false).get(0);
    int orderID = orderModel.getOrderIDByCustomer(cus.getCustomerId());
    Order od = orderModel.getByID(orderID);
    Set<OderDetail> listDetail = od.getOderDetails();
    model.addObject("listOrderDetail", listDetail);
    model.addObject("title", "My packages");
    return model;
}

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

@RequestMapping(value = "/logout")
public ModelAndView logout(HttpSession session) {
    session.removeAttribute("auth");
    session.removeAttribute("username");
    session.removeAttribute("id");
    ModelAndView model = new ModelAndView();
    model.setViewName("logout");
    return model;
}

From source file:com.br.uepb.controller.CadastroController.java

@RequestMapping(value = "/index/cadastrar.html", method = RequestMethod.GET)
public ModelAndView cadastrarGet(HttpServletRequest request) {

    ModelAndView modelAndView = new ModelAndView();
    modelAndView.setViewName("index/cadastrar");
    modelAndView.addObject("loginDomain", new LoginDomain());
    return modelAndView;
}

From source file:co.com.carpco.altablero.spring.web.controller.MainBoardController.java

@RequestMapping(value = { "/", "/admin/general" }, method = RequestMethod.GET)
public ModelAndView generalPage() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();

    if (!(auth instanceof AnonymousAuthenticationToken)) {

        ModelAndView model = roleUtils.createModelWithUserDetails(auth.getName());
        model.setViewName("admin/general");
        return model;
    } else {/*from   w ww  . ja  v  a2s  .  c o  m*/
        return new ModelAndView("redirect:/login");
    }
}

From source file:org.reallysqs.server.rest.QueueController.java

/**
 * Returns a list of queues for the appropriate URL signature.
 * In this case a request for the /queues URI, using the HTTP
 * GET method.//from   ww  w .  j a  v a2  s.  c o  m
 * 
 * @return An object composed of a model and view, the model containing the list of queues.
 */
@RequestMapping(value = "/queues", method = RequestMethod.GET)
public ModelAndView listQueues() {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("queuesList");
    mav.addObject("queues", this.simpleQueueService.getQueues());
    return mav;
}

From source file:org.reallysqs.server.rest.QueueController.java

/**
 * Creates a new queue when a POST request to /queues is invoked.
 * /*  w w w .  ja  v a  2 s  .  com*/
 * @param queueName The name of the new queue to create.
 * @return An object composed of a model and view, the model containing the newly created queue.
 */
@RequestMapping(value = "/queues", method = RequestMethod.POST)
public ModelAndView createQueue(@RequestParam("QueueName") String queueName) {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("createQueueResponse");
    mav.addObject("queue", this.simpleQueueService.createQueue(queueName));
    return mav;
}

From source file:org.reallysqs.server.rest.QueueController.java

/**
 * Returns a list of messages for a specific queue.
 * //from  w  w  w. j  a v a  2  s  .co m
 * @param queueName The name of the queue from which the messages should be retrieved.
 * @return An object composed of a model and view, the model containing the list of messages.
 */
@RequestMapping(value = "/queues/{queueName}", method = RequestMethod.GET)
public ModelAndView getMessagesFromQueue(@PathVariable String queueName) {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("receivedMessagesResponse");
    mav.addObject("messages", this.simpleQueueService.getMessagesForQueue(queueName));
    return mav;
}