I have a back button and i want to implement its functionality in controller, i don’t want to use window.history.back functionality.
When the user click on backbutton, how can i transfer the control to the controller. I don’t want to use form submission.
Steps that will be done are:
- User click on Back button, ( a javascript function is called with
onClickevent) - javascript function pass control to the controller, in other words javascript calls
a@RequestMappingmethod. - controller use (return
redirect:some page.jsp) for redirection.
How can i implement such scenario.
You can do something like below mentioned line. But according to me its not the clean way to do that. But it can’t be ignored as an option. Have a look at this line of code.
You just need to replace the /services part in the code with the url mapping you would like to go back to.
One another clean approach could be to pass this go back URL from the controller and then use the value in your jsp here.
Hope this helps you.
Cheers.