dev@jsftemplating.java.net

Re: JSFTemplating: Database/JSFtemplating related questions

From: Karam Singh Badesha <Karam.Badesha_at_Sun.COM>
Date: Wed, 17 Jan 2007 09:26:45 -0800

I think I would like to go with the AJAX approach but need more
information on that. In the example on your blog, you used onClick of
button to fire AJAX request. What would be it for a dropDown (onSelect)?

And, for the database call I can call my handler from the "!command"
event, right. Is it possible to see a full sample handler file with
correct import statements. And also where does the handler code go in
the application directory structure?

thanks,
Karam

Ken Paulsen wrote On 01/16/07 20:12,:
> 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

-- 
Karam S. Badesha, CAD Environment Support Team     karam.badesha_at_sun.com
Sun Microsystems                                   x48248
410 N. Mary Ave                                    408.774.8248
Sunnyvale, CA 94085