• ymz_lvx
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

お世話になります。

 

メソッドを実行するときに、引数を渡すにはどのようにすればよいのでしようか。

 

<apex:commandLink>と<apex:param>を組み合わせる方法ではうまくいかないでしょうか。

 

検索結果の画面から詳細画面へ切り替えるメソッドを実行する時に、IDを渡す仕組みとして

使おうとしています。

 

======================================

<apex:page controller="SampleMeisai" action="{!selectAllMeisai}">
    <apex:form >
        <apex:pageBlockSection>
            <apex:outputLabel value="{!meisaiId}"/>
            <apex:pageBlockTable value="{!meisai}" var="item" rowClasses="odd,even">
                  <apex:column headerValue="String1">
                      <apex:commandLink action="{!selectMeisai}" value="{!item.String1}">
                          <apex:param value="{!item.String1}" id="String1" />
                      </apex:commandLink>
                  </apex:column>
                  <apex:column headerValue="String2">
                      <apex:outputText value="{!item.String2"></apex:outputText>
                  </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:form>
</apex:page>

 

======================================

public class SampleMeisai{

 

    public List<SampleMeisai__c> meisai { get; set; }

    public String meisaiId { get; set; }

 

    public PageReference selectAllMeisai() {

        meisai = [SELECT String1__c, String2__c FROM SampleMeisai__c];

        return null;

        }

 

    public PageReference selectMeisai() {

        meisaiId = ApexPages.currentPage().getParameters().get('String1');

        return null;

    }

}

 

よろしくお願い致します。