OK, I've gotten closer:
<j:scope>
<j:set var="descriptor" value="${descriptor.SSHConnectorDescriptor}"/>
<st:include ... />
</j:scope>
This gets the st:include-d Jelly to refer to the proper descriptor. However,
when the DataBoundConstructor for the class that has an SSHConnector field is
invoked, there is no SSHConnector instance passed in (it is null). I'm guessing
(with my limited knowledge) that this is because st:include doesn't create a
Jelly 'context', so Jelly wants to pass all of SSHConnector's form fields to
the containing class' constructor, instead of constructing an SSHConnector
instance itself.
----- Original Message -----
From: [email protected]
To: [email protected]
At: Jul 12 2013 10:47:28
On 07/12/2013 09:53 AM, Kevin Fleming (BLOOMBERG/ 731 LEXIN) wrote:
> Interesting idea, but I'm not sure that will work when 'connector' is null
> because the object is being created by the user of the config form.
Usually in this context ${descriptor} is already set by the control that lets
the user add an item to configuration (<f:optionalProperty> for example). If
that is not
true in your case because you are doing something special, and you know that
you are adding an SSHConnector specifically (i.e. this is not polymorphic),
then you can use
Descriptor<?> d = Jenkins.getInstance().getDescriptorOrDie(SSHConnector.class);
and bind that to ${descriptor} in your Jelly. (For such cases it would be a bit
easier to use a Groovy view.)
--
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/groups/opt_out.
--
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/groups/opt_out.