Request.getSession does not return the same session

Our product is developed in Spring 3.0 MVC.

We used the session in the controllers as follows.

  @Controller
  public class LoginController{
     HttpSession session;

     @RequestMapping(value="/index.htm",method = RequestMethod.POST)
     public ModelAndView viewIndex(HttpServletRequest request){
     session=request.getSession(false);
     System.out.println(request.getSession(false));
     System.out.println(session);   
     }
  }

Here, in Firefox, I see that, as request.getSession(false)well as sessionprinted with the same value.

In IE, I see that it request.getSession(false)prints the value, and sessionprints like null.

What could be the reason?

Note. I do not use a filter for the session

+3
source share
1 answer

, . - . X Y. .

, , request.getSession() . - " ".

@RequestMapping(value="/index.htm",method = RequestMethod.POST)
public ModelAndView viewIndex(HttpServletRequest request){
    HttpSession session = request.getSession();
    // ... Get/set attributes?
}

, (Spring MVC - , API Servlet), : ? , , .

+10

All Articles