i need to display text in visualforce page, what i have access to is a List. i need to display first element of this list as text on page.
List<String> listOfStrings;
<h4>{!what expression to use listOfStrings}</h4>
i need to display text in visualforce page, what i have access to is a List. i need to display first element of this list as text on page.
|
|||
|
You can pass
|
|||||||||
|
You can use regular "array" notation to show the first element. Be sure to check to make sure the list is neither null nor empty before trying to access an array element.
Alternatively, you can use a repeat element:
Obviously, this is a bit more verbose, but works all the same. Finally, you can also simply use a getter method in Apex Code:
Which is then used as:
|
|||
|
@Walker Here I have tried to create a VF page and a Controller as explained by sfdcfox and Ashwani above. Hope this helps. VF Page
Controller
|
|||
|