嗨,我正在用代码编写一个简单的控制器类
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
为什么这个空值出现在参数中我想重定向一个与选择选项标签相关的值。请建议如何解决它