Setting Query String Parameters in Links

You can set query string parameters in links to pages by constructing the link URL manually, or by using <apex:param> tags within the <apex:outputLink> tag. For example, both of the following examples create identical links to an external page:

<apex:outputLink value="http://google.com/search?q={!account.name}">
    Search Google
</apex:outputLink>
<apex:outputLink value="http://google.com/search">
    Search Google
    <apex:param name="q" value="{!account.name}"/>
</apex:outputLink>

The latter method, which uses <apex:param> tags instead of manually creating the URL, is preferable for stylistic reasons.

Note

Note

In addition to <apex:outputLink>, use <apex:param> to set request parameters for <apex:commandLink>, and <apex:actionFunction>.

Previous
Next