1 请求来自哪一个页面 request.getHeader("referer");
在购买页,通过a标签进入AddressAction中,地址保存后,需要跳到原先的页面。
另外,另外一位哥哥的文章已经把它在spring mvc中的使用整理了出来
以下代码转自:http://jackyrong.iteye.com/blog/2008491
@RequestMapping(value = "/example", method = RequestMethod.GET)
public String getHello(@RequestHeader ("host") String hostName,
@RequestHeader ("Accept") String acceptType,
@RequestHeader ("Accept-Language") String acceptLang,
@RequestHeader ("Accept-Encoding") String acceptEnc,
@RequestHeader ("Cache-Control") String cacheCon,
@RequestHeader ("Cookie") String cookie,
@RequestHeader ("User-Agent") String userAgent)
{
System.out.println("Host : " + hostName);
System.out.println("Accept : " + acceptType);
System.out.println("Accept Language : " + acceptLang);
System.out.println("Accept Encoding : " + acceptEnc);
System.out.println("Cache-Control : " + cacheCon);
System.out.println("Cookie : " + cookie);
System.out.println("User-Agent : " + userAgent);
return "example";
}