如何知道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>
答案 0 :(得分:2)
开始这个的好地方是寻找其他插件。
果冻here看起来像这样
<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>
使用定义的函数here
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添加内部类。