0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Visualforce でMap型データの使い方

Last updated at Posted at 2023-05-29

コントローラで定義したMap型のデータを出力したい時はapex:repeatを使います。

apex
public with sharing class samplePageController {
    public Map<String,String> directors {
        get {
            return new Map<String, String> {
                'Kieslowski' => 'Poland', 
                'del Toro' => 'Mexico', 
                'Gondry' => 'France'
            };
        }
        set;
    }
}
visualforce
<apex:page controller='samplePageController'>
    <apex:repeat value="{!directors}" var="dirKey">
        Key:<apex:outputText value="{!dirKey}"/> 
        Value:<apex:outputText value="{!directors[dirKey]}"/><br/>
    </apex:repeat>
</apex:page>

出力結果
image.png

参照資料:
https://developer.salesforce.com/docs/atlas.ja-jp.pages.meta/pages/pages_dynamic_vf_maps_lists.htm

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?