-1

こんにちは、コードを使用して単純なコントローラー クラスを作成しています

public class OMTime1 {

    public String xx { get; set; }


  public PageReference continue1(){
    String url='/apex/OneMoreTime?id='+ApexPages.currentPage().getParameters().get('id')+'&process='+xx;
    PageReference page=new PageReference(url);
     page.setRedirect(true);
        return page;
    }
}

コード付きのシンプルな VF ページ

<apex:page controller="OMTime1" >
  <!-- Begin Default Content REMOVE THIS -->

  <!-- End Default Content REMOVE THIS -->
  <apex:form >
   <apex:selectList id="chooseColor" value="{!xx}" size="1">
            <apex:selectOption itemValue="1" itemLabel="Terminate Resource"/>
            <apex:selectOption itemValue="2"
             itemLabel="Change Resource Position at Same Location"/>
            <apex:selectOption itemValue="3" itemLabel="Change Resource Position with in same Location "/>
            <apex:selectOption itemValue="4"  itemLabel="Change Resource Position to a Different Location"/>
        </apex:selectList>
               </apex:form>
               <apex:form >
             <apex:commandButton value="Continue" action="{!continue1}"    id="theButton"/>
</apex:form>
</apex:page>

ユーザーが [続行] ページとしてボタン名をクリックすると、私のタスクは URL /apex/OneMoreTime?id=record_id&process=some_value some_value=1,2,3, or 4 にリダイレクトされますが、ボタンをクリックすると /apex/ にリダイレクトされますOneMoreTime?id=record_id&process=null

なぜこの null がパラメーターに入ってくるのか、選択オプションのラベルに関連する値をリダイレクトしたいのですが、解決方法を提案してください

4

1 に答える 1

0

短い答え:<apex:commandButton>壊れているので;)

最近、Salesforce専用のstackexchangeサイトに2つの最も一般的な回避策の説明を投稿しました:https ://salesforce.stackexchange.com/questions/4937/command-button-vs-command-link

を使用する<apex:commandLink styleClass="btn">と、ボタンとほぼ同じように見えます。

于 2012-12-03T07:32:04.103 に答える