Java practices site sums it up nicely:
Forward
- a forward is performed internally by the servlet
- the browser is completely unaware that it has taken place, so its original URL remains intact
- any browser reload of the resulting page will simple repeat the original request, with the original URL
Redirect
- a redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
- a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
- redirect is marginally slower than a forward, since it requires two browser requests, not one
- objects placed in the original request scope are not available to the second request
Forward happens while processing on the server,so you can not invoke it with JS, since JS execution is happening while processing client-side.
The only option I see is to redirect to the same URL, but append a query string parameter to instruct the server to perform a forward this time. However, that will reload the page.
solved I need to work it like