+ Start a Discussion

how to assign a value fetched from the constructo​r to a visualforc​e field.

on executing a class I am getting the value from external system , that value is in the constructor  .... but i need to assign that particular value to a visualforce page field   


Thanks in advance 

Bhawani SharmaBhawani Sharma

You can create a new variable for that value which you are getting from external system and set it in constructor. On VF page you can directly use it like

public String externalSystemValue {get; set;}

//In Constructor externalSystemValue = some value;

Use this variable on page
<apex:outputText value="{!externalSystemValue}" />




Create a variable within the class with get; set; .. Within the constructor assign the value to this variable ... Now you can use this variable in your apex page