[url]http://zachary-guo.iteye.com/blog/1503352[/url]

详细参考: [url]http://panyongzheng.iteye.com/blog/1942839[/url]
两种返回方式都可以是ModelAndView或者String类型
[color=red][b]forward[/b][/color]
String url="list";
return new ModelAndView(url);

[color=red][b]redirect[/b][/color]
String url="redirect:/list.do";
return new ModelAndView(url);

package com.pas.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class LoginController {

	@RequestMapping(value = "/forward.do")
	public String forward(@RequestParam("userName") String userName,
			@RequestParam("password") String password,
			@RequestParam("role") String role) {

		System.out.println("Login.....................................");
		return "index";//使用forward方式
	}

	@RequestMapping(value = "/redirect.do")
	public String redirect(@RequestParam("userName") String userName,
			@RequestParam("password") String password,
			@RequestParam("role") String role) {

		System.out.println("Login.....................................");
		return "redirect:index.jsp";//重定向方式
	}


}



或者这种方式:


public ModelAndView login(@RequestParam("userName") String userName,
			@RequestParam("password") String password,
			@RequestParam("role") String role) {
		System.out.println("Login.....................................");
		ModelAndView view = null;
		if (StringUtils.equalsIgnoreCase("pandy", userName)
				&& StringUtils.equalsIgnoreCase("pandy", password)) {
			view = new ModelAndView(new RedirectView("index.jsp"));
		} else {
			view = new ModelAndView("../login");
		}

		return view;
	}