SpringMVC-Controller

Group Action

一个Controller中多个action

package com.mkyong.common.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class CustomerController{

    @RequestMapping("/customer/add.htm")
    public ModelAndView add(HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        return new ModelAndView("CustomerAddView");

    }

    @RequestMapping("/customer/delete.htm")
    public ModelAndView delete(HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        return new ModelAndView("CustomerDeleteView");

    }

    @RequestMapping("/customer/update.htm")
    public ModelAndView update(HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        return new ModelAndView("CustomerUpdateView");

    }

    @RequestMapping("/customer/list.htm")
    public ModelAndView list(HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        return new ModelAndView("CustomerListView");

    }
}

Return ModelAndView

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s