logout does not work properly in struts2 - struts2

i am developing a struts project.
In login page action stored username and password in session.
In logout action class using session.invalid and removed that session details and redirected to index page.
But i click back button in browser it goes to the previous page.
Now i need sample code for if i am clicking back button after logging out it will show the error message or it display index page like yahoo mail.
need sample for that in struts2

As I know, very hard to do JS side. because back button belong to web browser. Our project do below way:
When logout, close currently window and open new window. that will help you clear history.

Related

Invoke a website button from iOS app

Will I able to invoke a button action ( HTTP Post/Get) through swift? I searched few posts and I am able to retrieve the contents from a web page. But I am not able to post anything. Say, web page has a login screen and the user needs to enter user name and password and click submit. How do I do this? note: The website I am using doesnt use URL parameters
Any help is highly appreciated. Thanks

Token session interceptor not submitting modfied form

I am using struts2 framework for my application.I have two pages. Page1 with form1 having modifiable data and submit button. I am using token session interceptor to prevent form re submission . On clicking submit from page1 it will call an action and navigate to Page2 and show the success/failure result.
The problem is if I use browser back button from Page2 to navigate back to Page1 and modify some form1 data and click submit, token session interceptor not calling the action again instead navigating to Page2 with previous result .
While using browser back button I need to prevent form re-submission if there is no change in data, on the other hand I need to submit the data if there is a modification.
You need to tell the browser not to cache anything, so when the back button is clicked, the browser tries to load the page again. For this purpose you need to write a caching interceptor that will set headers to response to instruct the browser to not cache pages. See Why after logout clicking back button on the page displays previous page content.

Safari on iPhone: Can I close the oauth browser tab?

I am using oauth to authenticate my iPhone-app's users. They click the login button and Safari opens to display the password entry page. Afterwards they are redirected using a custom url scheme, e.g. myapp://somethingsomething, which opens the application again (sending Safari into the background).
Can I close the browser tap during that redirect? Or directly afterwards via Javascript?
I ask because if my user imports a bording pass to his Passbook, Safari opens and logs my user in again, since the tab was still there.
Ok fixed by doing a setTimeout() call in JS before issuing the redirect. In the setTimeout() another redirect is executed: To a harmless page.

Refresh Registration page after submitting

In my site, I have made a registration page named registration.php. When I submits it redirects to reg_success.php. But If i press back button after my succesful registration, then also the registration page i.e registration.php remains filled. I want that if my registration is complete and I press back on browser then my registration page should come blank.
Kindly help me, what code I need to add to the registration page on clicking back on browser.
Use following line of code :
window.location.reload();
or also you can use following way :
window.location.href = window.location.href;

login page via popu-up window

Is there an example login page via a pop-up window?
Also, if the user performs some operation on the site that requires authentication, then show the login screen (if user not authorized).
You should just create you Login view, as you would implement it usually. And then apply fancybox (http://fancybox.net/) or bootstrap-modal(http://twitter.github.com/bootstrap/javascript.html) to make it work as modal.
Regarding re-direction: as soon as you use [Authorize] attribute as controller attribute and not-authorized user tries to hit its action, he will be redirected automatically;
you may use modal box plugins for jquery to create pop-up and place your log-in form in the pop-up.
Check out this modal window plugin which support html markup in the popup.
http://www.zurb.com/playground/reveal-modal-plugin

Resources