0

これは、HelloWorldBuilder に基づくビルダー クラスです。

public class LogInfoBuilder extends Builder {
    private final TimerSettings settings = new TimerSettings();

    private final List<String> infoCollection = new ArrayList<String>();

    // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
    @DataBoundConstructor
    public LogInfoBuilder(String key, boolean isStart) {
        settings.setKey(key);
        settings.setIsStart(isStart);
    }

    /**
     * We'll use this from the <tt>config.jelly</tt>.
     */
    public String getKey() {
        return settings.getKey();
    }

    public boolean isStart()
    {
        return settings.getIsStart();
    }

    ...

これは config.jelly です

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
  <!--
    This jelly script is used for per-project configuration.

    See global.jelly for a general discussion about jelly script.
  -->

  <!--
    Creates a text field that shows the value of the "name" property.
    When submitted, it will be passed to the corresponding constructor parameter.
  -->
  <f:entry title="Key" field="key">
    <f:textbox />
  </f:entry>

  <!--
  <f:entry title="Start?" field="isstart">
    <select name="isStart">
      <option value="true" selected="${it.isstart}">Yes</option>
      <option value="false" selected="${!it.isstart}">No!</option>
    </select>
  </f:entry>
  -->

  <f:entry title="Starting point?" description="If checked, this will be the starting point.">
    <f:checkbox name="start" checked="${it.start}"/>
  </f:entry>
</j:jelly>

チェックボックスはジョブ構成ページに表示されますが、そこから値を設定できません。つまり、そのページのチェックボックスをオンまたはオフにしても、ビルダー クラスの値には影響しません。

構成ページは次のとおりです。UI は適切にレンダリングされます。 ここに画像の説明を入力

しかし、出力は私が期待するものではありませんfalse。チェックボックスをオンにしても、常に出力されます。 ここに画像の説明を入力

ビルダーおよび/またはゼリーファイルで何が間違っていましたか?

4

2 に答える 2

0

重要なのは、「フィールド」属性を使用することです。<f:entry> または <f:checkbox> のいずれか

<f:entry title="Starting point?" description="...">
  <f:checkbox field="start" />
</f:entry>

or
<f:entry title="Starting point?" field="start" description="...">
  <f:checkbox />
</f:entry>
于 2018-05-27T07:32:14.370 に答える