I'm familiar with ApexPages.currentPage().getUrl()
which returns the second part of the url (/apex/Test!id=2314dsdf32) and also I know system.currentPageReference().getParameters()
which basically does the same thing but returns these parameters in a map.
My issue is that the URL that I have for my page is something like this:
/apex/MyPage?var1=123&var2=abc
but when I use the above methods they return some additional variables that I don't see in my url (in browser) that's why I called them hidden parameters! Returned URL using .getURL()
looks like this:
/apex/MyPage?var1=123&com.salesforce.visualforce.ViewStateCSRF=VmpFPSxNakF4Tnkwd0 5DMHlPVlF4TnpveU56bzFNaT&j_id0%3ASiteTemplate%3Aj_id39=j_id0%3ASiteTemplate%3Aj_ id39&var2=abc
How can I get rid of those variables and only see var1 and var2? Note that I want a solution that works the same for different pages for which I may have different variables, if they were always the same I would've got that from the map
Update
Since some of you asked I thought we need more explanation here. I have a template which lots of different pages will use this template. In the controller of this template I want to get the parameters of that page. That page may have no parameters or a few parameters and that is different (both in label/value) from page to page.