Newer Version Available

This content describes an older version of this product. View Latest

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:

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

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

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

Note