0
我想自己處理請求和會話屬性,而不是將它留給spring @SessionAttributes,例如用於登錄或cookie處理。 我只是無法弄清楚如何從控制器內部訪問HttpRequest,我需要一種方法來訪問@RequestAttribute上方的一層,並訪問HttpRequest本身。Spring MVC3訪問HttpServletRequest
@RequestMapping(value="/") public String home(HttpServletRequest request){
System.out.println(""+request.getSession().getCreationTime());
return "home";
}
上述方法不打印anithing
: 條紋在用於通過實現一個ApplicationContext並調用的getAttribute()此外,傳遞療法的HttpServletRequest作爲參數似乎並沒有被工作做到這一點
您對此有何建議?