• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Simple login filter causing issues

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

I am working on a simple filter: To keep my webapp only accessible to logged in users. for that i designed a simple filter which is not working as it should. I need some ideas on how to refine it more so its more robust. And the reason why i designed it doesnt really gets acheieved some how:

Here is my code:

for struts config.xml:

my do filter method in my filter class:

What this does is It checks for a loginbean and if it exists that means the persons logged in. Now, when the user comes in the first time this filter also runs at that point he doesnt have any session nor the bean in the session. so i just route him to login.jsp, If there is a session means that he is probably trying to log in and will not hve a login bean. this is giving me problems. Is there a way that I can only run this filter after the user has logged in. Also, when i try to access a url from browser after logging out, it doesnot give me any issues, it loads up the page, In log out i have removed the login bean and invalidated the session. There is no way i can remove or destory the sesssion at logout. so when it comes to the filter the session is still there and calls the login action class where it is designed to throw the user with errors on the login page but it doesnt.

Can any one see what i am doing wrong or how to make it more robust to not let any user access any urls without logging in.

Thanks in advance..
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you mean web.xml.

I find the code completely illegible--could you format it properly please? Thanks.
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic