• 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 expire a session in struts without using cookies

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This one is the west way for invalidate the session.
request.getSession().invalidate()
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic