简体   繁体   中英

How to check when webpage reload button is pressed in Java

I'm using JSP-s and Servlets, and I don't know how to check if a client asks for reloading the page. I need to redirect to homepage whenever a user tries to reload. Is there any method like request.getAction(); so that I can check if it equals to "reload"? Thank you.

Java plays on server side and Javascript plays on client end.

request.getAction();

Is server side code and reload happens on client end.

You need some javascript to know it

window.onbeforeunload = funcRef

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM