【发布时间】:2024-04-11 20:05:12
【问题描述】:
我可以从 global.jelly 文件中执行此操作,但它不适用于 config.jelly 文件。 以下是创建 global.jelly 文件的过程:
果冻:
<f:entry title="Value" field="value">
<f:textbox />
</f:entry>
JAVA:
public static final class Descriptor extends BuildStepDescriptor<Builder>{
//descriptor's code
/**
* Performs on-the-fly validation of the form field 'value'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return Indicates the outcome of the validation. This is sent to the
* browser.
*/
public FormValidation doCheckValue(@QueryParameter String value) throws IOException, ServletException {
if(value.isEmpty()) {
return FormValidation.warning("You must fill this box!");
}
return FormValidation.ok();
}
}
当果冻代码放在配置文件(config.jelly)中时,这不再适用,无论doCheckValue方法是放在插件类还是它的描述符中。
【问题讨论】:
标签: java validation plugins jenkins jelly