Saturday, 15 August 2015

Spring MVC - redirect automatically append JsessionID -



Spring MVC - redirect automatically append JsessionID -

this handler method , if user attribute in session not null (he logged in) forwards him success page , if not, redirect him login page.

@requestmapping(value = "/") public string showhome(httpsession session) { user user = (user) session.getattribute("user"); if (user != null) { homecoming "success"; } homecoming "redirect:/login"; }

the problem , first time access page, redirect login page automatically append jssessionid @ end of url : "/login;jsessionid=fc75bc999410329e65785274bf0eb623". there no problem when changing homecoming "login".

in tomcat 7, create alter in tomcat_home/web.xml

<session-config> <tracking-mode>cookie</tracking-mode> </session-config>

spring spring-mvc

No comments:

Post a Comment