Maven 果冻复选框未在UI中持久化
我在jenkins插件中有一个果冻复选框:Maven 果冻复选框未在UI中持久化,maven,jenkins,jenkins-plugins,jelly,jenkins-cli,Maven,Jenkins,Jenkins Plugins,Jelly,Jenkins Cli,我在jenkins插件中有一个果冻复选框: <f:optionalBlock name="sendFcmPayload" help="/plugin/artifactory/help/common/help-sendFcmPayload.html" inline="true" checked="${instance.sendFcmPayload}"
<f:optionalBlock name="sendFcmPayload"
help="/plugin/artifactory/help/common/help-sendFcmPayload.html"
inline="true" checked="${instance.sendFcmPayload}"
title="Send details of this build to FCM">
</f:optionalBlock>
我在后端引用此值,收到的值根据我在UI中选择的内容是正确的,但问题是每次保存作业配置时,UI中的复选框值不会持续存在
我暂时将可选块保留为空,但根据是否选中它,我会在后端发送一个布尔值。由于您将
f:optionalBlock
的主体保留为空,我假设您只需将复选框绑定到布尔属性。如果是这样,在Jelly文件中创建复选框的正确方法就是使用嵌套在f:entry
中的f:checkbox
,如下所示:
<f:entry title="Send details of this build to FCM" field="sendFcmPayload">
<f:checkbox/>
</f:entry>
我希望这有帮助 由于某些原因,复选框的行为方式与其他字段不同,因此仅指定
标题
和字段
是不够的。要保留复选框,还需要将属性name
和inline
添加到f:entry
,如下所示:
<f:entry name="sendFcmPayload" inline="true" title="Send details of this build to FCM" field="sendFcmPayload">
<f:checkbox />
</f:entry>
可选块是否为空@ᴳᵁᴵᴰᴼ 我暂时将可选块保留为空,但根据是否检查,我会在后端发送一个布尔值。