我如何知道哪个单选按钮在Jenkins中被选中?
我的代码示例:<f:section title="Select or upload application file">
<f:radioBlock checked="true" name="file" value="" title="Upload new version" inline="true">
<f:entry title="File Path" field="appFile">
<f:textbox/>
</f:entry>
<f:entry title="New Version" field="newVersion">
<f:textbox/>
</f:entry>
</f:radioBlock>
<f:radioBlock checked="false" name="file" value="" title="Available versions" inline="true">
<f:entry title="" field="oldVersion">
<f:select/>
</f:entry>
</f:radioBlock>
</f:section>
一个开始的好地方是寻找其他插件。
这里的果冻看起来像这样
<f:radioBlock name="testToRun" value="BUILTIN_FUZZ" checked="${instance.isTestType('BUILTIN_FUZZ')}" title="Built-in Fuzz" inline="true">
<f:nested>
<f:entry title="Event Count" field="eventCount" description="[Optional] Number of fuzz events.">
<f:textbox/>
</f:entry>
<f:entry title="Event Throttle" field="eventThrottle" description="[Optional] Number for event throttle.">
<f:textbox/>
</f:entry>
<f:entry title="Seed" field="seed" description="[Optional] Seed to use for randomizing events.">
<f:textbox/>
</f:entry>
</f:nested>
</f:radioBlock>
使用这里定义的函数
public String isTestType(String testTypeName) {
return this.testToRun.equalsIgnoreCase(testTypeName) ? "true" : "";
}
你需要把checked属性绑定到实例
checked="${instance.isTestType('BUILTIN_FUZZ')}"
在
类上有一个公共属性public String testToRun;
并将该字段添加到DataBoundConstructor
@DataBoundConstructor
@SuppressWarnings("unused")
public AWSDeviceFarmRecorder(String projectName,
String devicePoolName,
String appArtifact,
String testToRun,
而你已经有
了inline="true"
所以你不需要添加内部类与它自己的DataBoundConstructor。