What is Query String ?
In the URL format after '?', you can pass set of key-value pairs which is called Query Strings.
How to frame Query String in OutputLink ?
OutputLink tag is used to provide the hyper link for a element in the page. If you need to pass Query String, you can use param tag for that.What is the use ?
By using param tag, we can provide dynamic value, rather than the hardcoded value for Query String parameters. Also, if you have more than one Query String parameters, the code looks very clean by using param tag.
Where is the code ?
I have illustrated through how to pass the parameters through param tag for OutputLink below,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<!-- OutputLink - Using Param tag --> | |
<apex:outputLink value="{!$Page.testpage12_102122016}"> | |
<apex:param name="param1" value="Hello"/> | |
<apex:param name="param2" value="Sankaran"/> | |
Click Here | |
</apex:outputLink> | |
<!-- Output - Parameter 1 --> | |
<apex:outputPanel layout="block" rendered="{!$CurrentPage.Parameters.param1 != Null}"> | |
<apex:sectionHeader title="Parameter 1"/> | |
<apex:outputText value="{!$CurrentPage.Parameters.param1}"/> | |
</apex:outputPanel> | |
<!-- Output - Parameter 2 --> | |
<apex:outputPanel layout="block" rendered="{!$CurrentPage.Parameters.param2 != Null}"> | |
<apex:sectionHeader title="Parameter 2"/> | |
<apex:outputText value="{!$CurrentPage.Parameters.param2}"/> | |
</apex:outputPanel> | |
</apex:page> |
No comments:
Post a Comment
Thanks for reading my blog !