0

I have a problem with HttpSessions when I use them in web server. Project based on Spring MVC and works fine locally, but when I endure it on real web server session not working. I use them for user logging. Code of user login:

@RequestMapping(value = {"/system/login.do","/system/login.do/"}, method = RequestMethod.POST)
public ModelAndView login(@RequestParam("username") String login, @RequestParam("password") String passwd, 
        HttpServletRequest request,
    HttpServletResponse response) throws Exception {
            UserModel user = new UserModel().getUser(login, passwd); 
            HttpSession session = request.getSession(true);
    session.setAttribute("user",  user);
            return new ModelAndView("redirect:" + "/system/panel");

}

In web server I use Apache and Tomcat 8. Also in web.xml sessions is enabled. I would appreciate any help.

This is how I check session in admin JSP-page:

<c:if test="${sessionScope.user == null}">
    <c:redirect url="/index"/>
</c:if>

And the example of use info in session:

<c:out value="${sessionScope.user.username}"/>
MrKiwi
  • 1
  • 1

0 Answers0