Got it. f:property is what I needed, it works beautifully inside an f:entry 
with just the field name specified; all the rest of the detailed are inferred 
as they should be, and the object is properly instantiated and persisted. As a 
bonus, the help links for the fields of the embedded object work now too!

----- Original Message -----
From: jenkinsci-dev@googlegroups.com
To: jenkinsci-dev@googlegroups.com
At: Jul 12 2013 12:46:43

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: jenkinsci-dev@googlegroups.com
To: jenkinsci-dev@googlegroups.com
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 jenkinsci-dev+unsubscr...@googlegroups.com.
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 jenkinsci-dev+unsubscr...@googlegroups.com.
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 jenkinsci-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to