JSP Back Button
Jsp Back Button enables the user back to the page from which they just come from.
Understand with Example
The Tutorial illustrate an example from 'JSP Back Button'. To understand the example we have used two jsp pages: back Button.jsp and createBackButton.jsp. The backButton.jsp has three fields and a submit button whose action is to be performed on the createBackButton.jsp where we defined another field text area and back button. The backButton.jsp validates the form by displaying the alert message "Please enter the value", incase the user do not enter the values in specified field. The Back button retrieve the information values from the create back button and displayed in text area. The Back button takes the user back to the page they just came from. A Back button is created by
INPUT type="button" value="Back" onclick()="history.back()": The Back button is created and takes the user back to the page from where the user came from.
On Click( ) :" " tells the browser to do the command in the quotes when the button is clicked and history.back() takes the viewer on step back in their previous jsp .
Here is the code of backButton.jsp
Here is the code of createBackButton.jsp
Output will be displayed as:
On clicking the button, the action is performed and displays the following: