I would like to refresh the current page when a button is clicked.
Using JavaScript, I have the following:
I'd suggest <a href='page1.jsp'>Refresh</a>
.
There are several ways to reload the current page using a button or other trigger. The examples below use a button click to reload the page but you can use a text hyperlink or any trigger you like.
<input type="button" value="Reload Page" onClick="window.location.reload()">
<input type="button" value="Reload Page" onClick="history.go(0)">
<input type="button" value="Reload Page" onClick="window.location.href=window.location.href">
Works for every browser.
<button type="button" onClick="Refresh()">Close</button>
<script>
function Refresh() {
window.parent.location = window.parent.location.href;
}
</script>
<button onclick=location=URL>Refresh</button>
Small hack.
<button type="button" onClick="refreshPage()">Close</button>
<script>
function refreshPage(){
window.location.reload();
}
</script>
or
<button type="button" onClick="window.location.reload();">Close</button>
This question actually is not JSP related, it is HTTP related. you can just do:
window.location = window.location;