+ Start a Discussion
Ravindar AdminRavindar Admin 

%20 is changing to + through outputLink

Hi,  I am using Output link as below:
<apex:outputLink value="/apex/Web_LatestNews_LTG?tags=Selective%20Line&thematicPage=1">
 </apex:outputLink>
When I click on the link, It should redirect as it is. But, '%20' is changing to '+' as below:
https://test-test.cs86.force.com/Web_LatestNews_LTG?tags=Selective+Line&thematicPage=1

How to prevent changing '%20' to '+' ?

 
Best Answer chosen by Ravindar Admin
KdKomalKdKomal
Hi Ravindar,

Please pass the parameter is <apex:param> as below.

<apex:outputLink value=""/apex/Web_LatestNews_LTG" >Click Me
   <apex:param name="tags" value="Selective%20Line" ></apex:param>
    <apex:param name="thematicPage" value="1"></apex:param>
</apex:outputLink> 

In your controller for the page, in constructor fetch these as below :-
 ApexPages.currentPage().getParameters().get('tags');
 ApexPages.currentPage().getParameters().get('thematicPage');

I hope this helps you out.

All Answers

KdKomalKdKomal
Hi Ravindar,

In URL, a space is replaced with "%20" or (+) sign. I would suggest to remove the space and then try with the output link, as URL cannot contains spaces.
Ravindar AdminRavindar Admin
Hi @Komal,

My URL doesn't have any spaces. We hardcoded %20 in outputLink. The expected o/p only comes If the URL contains %20. But, It is changing to '+'. Thanks.
 
KdKomalKdKomal
Hi Ravindar,

Please pass the parameter is <apex:param> as below.

<apex:outputLink value=""/apex/Web_LatestNews_LTG" >Click Me
   <apex:param name="tags" value="Selective%20Line" ></apex:param>
    <apex:param name="thematicPage" value="1"></apex:param>
</apex:outputLink> 

In your controller for the page, in constructor fetch these as below :-
 ApexPages.currentPage().getParameters().get('tags');
 ApexPages.currentPage().getParameters().get('thematicPage');

I hope this helps you out.
This was selected as the best answer