Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Struts2 Session

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

I am using Struts2 in my application. In my application I have one login form and one main page. on the successfull login I call main page and inside that main page I have called another action. Upto this all is working fine and page is also display after successfull login but when I press F5 or clik on browser refresh button it will give me login page but I want the same page on which I fire F5 or refresh button. How can I achieve this, my struts.xml is as follow..



After login I call main.jsp and from main.jsp I am calling mytable action. After showing me the main page the address bar of browser still shows me the Login action means http://localhost:8080/Login is it ok or it should shows me like http://localhost:8080/mytable

So please help me how can I maintain session.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sonu Sen wrote:
So please help me how can I maintain session.



I don't think the problem is the session. F5 refreshes the URL in the browser address bar. If you are simply forwarding from your action after logging in, you will still have the original URL, so hitting F5 will reload the login page. What you want to do is use the "redirect" type in your action result so the URL in the browser will be the main page/action.
Redirect Result
 
This tiny ad is wafer thin:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic