Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to expire a session in struts without using cookies

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am developing an application using struts 1.2. i have a admin login page(AdminId , Password) .i have set scope="session" in struts-config.xml file for the adminLogin action mapping, so i can access the AdminId in consequentive pages like AddEmployee.jsp, AddProduct.jsp.

when i logout i should not be able to access AddEmployee.jsp, AddProduct.jsp by directly specifying in the browser or use back button to go to these pages . but i still can access these pages

can any one tell me some code or way to end a session . the session is set using the struts-config.xml file.

The below code is used to set the session for the admin login

<action path="/AdminLoginPath"
type="org.admin.dev.AdminLoginAction"
name="AdminLoginFormBean" scope="session"
input="/AdminLogin.jsp"> <forward name="Login"
path="/AdminWorkPage.jsp" /> <forward name="HomePage"
path="/index.jsp" />
</action>
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satya,

Please use session.removeAttribute("Bean",bean);

This is not from struts framework.

Please let me know if you have anything in struts to do the same

Regards
Madhav
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by K Sathya Narayanan:
can any one tell me some code or way to end a session


In your action:
request.getSession().invalidate()
 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sathya,

As said by Jeanne Boyarsky invalidating the session will be the best way.

Ananth
Sysvine
[ November 23, 2007: Message edited by: Ananth Chellathurai ]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This one is the west way for invalidate the session.
request.getSession().invalidate()
 
Why fit in when you were born to stand out? - Seuss. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic