我刚刚开始使用Jelly进行编码,我有一个问题: 我想打印我在文本框中写的值。文本框位于我检查的可选块中。但是当我想打印它的值时,它会打印" null"。我认为没有保存该值,或者我必须检查是否检查了checbox ... 以下是我的代码,感谢您的帮助
config.jelly
<f:block>
<table>
<f:optionalBlock name="toRemote" title="Remote">
<f:entry title="Full parameter name">
<f:textbox name="parameter_name" value="${it.parameter_name}"/>
</f:entry>
</f:optionalBlock>
</table>
</f:block>
HelloWorldBuilder.java
public class HelloWorldBuilder extends Builder {
private final String parameter_name;
/**
* This annotation tells Hudson to call this constructor, with
* values from the configuration form page with matching parameter names.
*/
@DataBoundConstructor
public HelloWorldBuilder(String parameter_name) {
this.parameter_name = parameter_name;
}
/**
* We'll use this from the <tt>config.jelly</tt>.
*/
public String getParameter_ame() {
return parameter_name;
}
@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException {
// this is where you 'build' the project
// since this is a dummy, we just say 'hello world' and call that a build
listener.getLogger().println("Parameter name = " + parameter_name + "!");
build.save();
return true;
}