The Visualforce page has
<apex:commandButton action="{!submit}" value="Submit"/>
The submit method returns void.
public void submit()
Now the page has certain URL parameters, the submit method correctly possesses them and works as expected except that while returning, it deletes URL parameters.
The URL '/apex/pageName?var1=abcd&var2=pqrs' becomes '/apex/pageName'. The parameters are gone. Problem with this is when user refreshes the page, it doesn't work as expected as url parameters are not there.
When I change submit method to return PageReference of current page, it rewrites URL with URL parameters + view state which looks unclean.
PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
pageRef.setRedirect(true);
return pageRef;
How can we ensure that URL parameters are not changed.