dev@jsftemplating.java.net

Re: JSFTemplating: Database/JSFtemplating related questions

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Tue, 16 Jan 2007 20:12:54 -0800

Hi Karam,

You can do this in a Bean if you'd like. Many people prefer doing it
this way.

You can also do this by putting your data in the scope manually.
JSFTemplating makes this convenient:

<sun:dropDown id="dd1" ...>
    <!beforeCreate
       getDropDownData(arg1="dd1" ... output=>$pageSession{dd1});
    />
</sun:dropDown>

You can also make a dropDown submit itself so that you can populate the
next dropDown. In JSFTemplating, you can take action on the that action
by doing the following:

<sun:dropDown id="dd1"...>
    <!beforeCreate ... />
    <!command
       getDropDownData(arg1="dd2" ... output=>$pageSession{dd2});
    />
</sun:dropDown>

Where the handler(s) in the "!command" event populate the next drop down
with data. Doing this approach causes the whole page to refresh, which
isn't ideal. You can use Ajax techniques to avoid this. I wrote a blog
on how to do this in this environment. You can read about it here:

    http://blogs.sun.com/paulsen/entry/jsftemplating_dynamicfaces_easy_ajax

I hope this helps.

Ken Paulsen
ken.paulsen_at_sun.com

Karam Singh Badesha wrote:
> Hi,
> We have a form which is basically database driven and I was wondering
> what is the best way to do this. Here is the scenario:
>
> dropdown1 -> dropdown2 -> dropdown3 -> Button
>
> Database call to fill up dropdown1, then depending on dropdown1 value,
> another database call to fill up dropdown2 ...
> After all the fields are filled, user clicks on Button to go the next
> page.
>
> In the dropdown tag options, I don't see how I can specify the values
> without using a bean:
> <sun:dropDown items="#{MenuListBean.projectMenuOptions}" />
>
> Now does that mean that I need to make these database calls inside the
> MenuListBean? or is there another way to do this? Any sample code will
> be helpful.
>
> thanks,
> -Karam