Sunday, June 8, 2014

How to pass parameter from page to component in visualforce page

When we work with visualforce pages then it is a good practice to put the code that will be used more then once into a component. This approch is good but it is not dynamic say "Search". If you need a page to Search different objects and also need to use component then an fast approch is to pass the variable name as parameter and search on that bases.

Example:

Now if the page is passing the value in objName parameter then at the component side we can get this as :

Example:

Now the values passed from the page is assigned to the variable in component.

No comments:

Post a Comment