我目前正在开发我的第一个Jenkins插件。
我需要在作业页面上有一个下拉菜单,该下拉菜单通过Java方法填充,但是jelly和java文件似乎无法正常协同工作。
jobMain.jelly
当我运行这个程序时,在工作页面上有一个空的下拉菜单。我可能做错了什么?
我需要在作业页面上有一个下拉菜单,该下拉菜单通过Java方法填充,但是jelly和java文件似乎无法正常协同工作。
jobMain.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">
<h2>FooBar</h2>
<f:entry field="selection" title="Choose">
<f:select />
</f:entry>
</j:jelly>
JavaClass.java
public class JavaClass implements Action {
private AbstractProject ap;
public JavaClass(AbstractProject ap) {
this.ap = ap;
}
public String getIconFileName() {
return null;
}
public String getDisplayName() {
return "";
}
public String getUrlName() {
return "something";
}
@Extension
public static final class DescriptorImpl extends TransientProjectActionFactory {
String selection;
public DescriptorImpl() throws IOException {
}
@DataBoundConstructor
public DescriptorImpl(String selection) {
this.selection = selection;
}
public ListBoxModel doFillSelectionItems() throws IOException {
ListBoxModel model = new ListBoxModel();
model.add("test");
return model;
}
@Override
public Collection<? extends Action> createFor(AbstractProject target) {
return Arrays.asList(new JavaClass(target));
}
}
}
当我运行这个程序时,在工作页面上有一个空的下拉菜单。我可能做错了什么?