Question

Form data is always posted back to the underlying page URL (to save the view state). Is there any way (filter?) we could append request params to the response url, without any redirect ?

For example, I have a page1.xhtml with form data. After submitting the form, let's say, I get the results in page1.xhtml itself. But I needed to have the url modified as page1.xhtml?view=1

Thanks very much.

Was it helpful?

Solution

I have come up with a solution that seems to work for my use case without any issues. Instead of PostRedirectGet I have used HTML5 History API replaceState to replace the postback url (page1.xhtml) with url with request params (page1.xhtml?view=1) on client side while page rendering. It is supported on IE10+, and latest FF/Chrome, and old browsers (HTML4) with history.js. Please do share your views on this solution. Thanks very much.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top