Setting default values in a jelly file for a @DataBoundConstructor instance

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting default values in a jelly file for a @DataBoundConstructor instance

Ulli Hafner-2
Is there a way to specify some default values for a parameter in a jelly form,
so that the @DataBoundConstructor will be correctly called?

E.g.,

I have a Publisher with two constructor parameters a and b. However, depending
on a dynamic configuration, there is only one input field in the jelly form to
enter a value for a. The corresponding input field for value b is not shown,
due to a dynamic evaluation:

            <f:entry field="a">
        <f:textbox/>
            </f:entry>
       <j:if test="${it.showEntryB()}">
            <f:entry field="b">
        <f:textbox/>
            </f:entry>
       </j:if>

If the entry b is not shown, then the constructor will not invoked, since there is no value for b.

Any ideas?

Thanks, Ulli
--
Avaloq - essential for banking.
 
Avaloq Evolution AG
Allmendstrasse 140, 8027 Zürich
T +41 44 488 6790, F +41 44 488 6868, http://www.avaloq.com 
Dr. Ullrich Hafner, mailto:[hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Setting default values in a jelly file for a @DataBoundConstructor instance

Dean Yu
I think the problem is that the Jelly processing is on the server side so when the HTML is rendered, there is no input field for B at all. You could produce a hidden field b if it's not supposed to be shown, then you can define it with a default value of your choosing.

  -- Dean

> -----Original Message-----
> From: Hafner Ullrich [mailto:[hidden email]]
> Sent: Wednesday, July 08, 2009 11:01 AM
> To: [hidden email]
> Subject: Setting default values in a jelly file for a
> @DataBoundConstructor instance
>
> Is there a way to specify some default values for a parameter
> in a jelly form, so that the @DataBoundConstructor will be
> correctly called?
>
> E.g.,
>
> I have a Publisher with two constructor parameters a and b.
> However, depending on a dynamic configuration, there is only
> one input field in the jelly form to enter a value for a. The
> corresponding input field for value b is not shown, due to a
> dynamic evaluation:
>
>    <f:entry field="a">
>         <f:textbox/>
>    </f:entry>
>        <j:if test="${it.showEntryB()}">
>    <f:entry field="b">
>         <f:textbox/>
>    </f:entry>
>        </j:if>
>
> If the entry b is not shown, then the constructor will not
> invoked, since there is no value for b.
>
> Any ideas?
>
> Thanks, Ulli
> --
> Avaloq - essential for banking.
>  
> Avaloq Evolution AG
> Allmendstrasse 140, 8027 Zürich
> T +41 44 488 6790, F +41 44 488 6868, http://www.avaloq.com 
> Dr. Ullrich Hafner, mailto:[hidden email]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Setting default values in a jelly file for a @DataBoundConstructor instance

Kohsuke Kawaguchi
Administrator
In reply to this post by Ulli Hafner-2

I believe the constructor will be invoked, with the 'b' parameter set to
null.

Hafner Ullrich wrote:

> Is there a way to specify some default values for a parameter in a jelly form,
> so that the @DataBoundConstructor will be correctly called?
>
> E.g.,
>
> I have a Publisher with two constructor parameters a and b. However, depending
> on a dynamic configuration, there is only one input field in the jelly form to
> enter a value for a. The corresponding input field for value b is not shown,
> due to a dynamic evaluation:
>
>    <f:entry field="a">
>         <f:textbox/>
>    </f:entry>
>        <j:if test="${it.showEntryB()}">
>    <f:entry field="b">
>         <f:textbox/>
>    </f:entry>
>        </j:if>
>
> If the entry b is not shown, then the constructor will not invoked, since there is no value for b.
>
> Any ideas?
>
> Thanks, Ulli

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment