• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use SessionFilter in spring mvc 4.1

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am migrating an already build application from spring MVC 2.5 to Spring MVC 4.1 .
Facing problems during the process.

1) when i configure SessionFilter in web.xml the formatting of the JSP pages goes off . It totally ignores style.css under /css/ folder .

2) Filter always redirects to Login.jsp page printing in SessionFilter as ( session == null = true ).

Beow is the Filter's doFilter ()


Here is web.xml



This is very weird because same Filter with same configuration works fine in springMVC 2.5 app.

Also in login.jsp <%page session=false%> is not set .. So there is no point that session is not getting created in it.

Below is the LoginController method




Please help ... What i think is when first time logon page arrives it shows login.jsp page .. but when user submits it , form submits action="Welcome" that checks by filter
here it sees session == null
i am not getting why session is null when user clieck on submit button .

I am sorry for poorly writing my problem .
if more clarification is required , please let me know .

Thanks in advance.

Any help is much appreciated.


 
subuhi nigar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

My problem seems to be resolved as soon as i set @scope("session") on LoginController .

Spring 4.1 behaves differently ! in spring 2.5 i hadn't set scope=session in <bean ...configuration in app-servlet.xml . There too LoginController is default singleton scope . Here too it is singleton .But if i remove @scope("session") and modify


It prints session null .

Anyway , I need to understand spring mvc 4.1 flow . it seems to be different than 2.5 a lot .
 
reply
    Bookmark Topic Watch Topic
  • New Topic