Am 03.09.2014 um 22:45 schrieb [email protected]: > Hi all, > > I am currently developing my first Jenkins plugin. > I need to have a dropdown menu on the job page that is filled via a java > method, but the jelly and the java file don't seem to work properly together: > There is just an empty dropdown list. > What could be wrong? > > 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"> > <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;
This field should be in your JavaClass class
>
>
> public DescriptorImpl() throws IOException {
>
> }
>
>
No constructor required
> @DataBoundConstructor
>
> public DescriptorImpl(String selection) {
>
> this.selection = selection;
>
> }
>
This DataBoundConstructor constructor should be in your JavaClass class
>
> 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));
>
> }
>
> }
>
> }
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail
