This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
OK, so far so good, I've made quite a lot of progress with JSF 2.0, but now I'm getting to a particularly important part involving Ajax, which I'm having trouble understanding.
The code without using Ajax works, but it causes irritating page "flips" and messes up the display, and I wish to use Ajax to get rid of that.
The relevant part of the xhtml file is as follows:
where I specify a menu where you can select one out of several options. Once you have decided which option you want, you click <h:commandButton> "Select Set", which fires
an action listener that then downloads from an external file the data you want, which is then used to set up a second menu. The reason why I have chosen to use a command
button once you have selected an option is because a file is downloaded, and I don't want a file to be downloaded every time you change the selection, only when you
specifically want it. <h:commandButton> comment A controls the values given by comments a, but I would like this to be done by Ajax.
Once you have downloaded data, it appears in a second menu in <h:selectOneListbox>, and you can make changes to selected values by inputting text in <h:inputText>, then
<h:commandButton> "Update Abundance" will copy the value in <h:inputText> to the selected place in <h:selectOneListbox>, i.e. <h:commandButton> comment C controls comments c.
Again I would like this to use Ajax.
The code in my bean is as follows, where "a", "A", "c" and "C" correspond to the code in the xhtml file:
The basic question is how to "Ajaxify" the code in a suitable way. Any ideas and suggestions would be most appreciated.
I don't think it is good to put so long code and many questions in one post. Better understandable is to put simple question or a few easy to answer questions.
Because the long time should be spent to realize something and I stiil don't understand all your post
As I see you want to do similar to what I did a few weeks ago. As abundanceSet0 is selected corresponding list for abundances0 is constructed.
Together with Tim Holloway I did:
In backing bean I have:
When value of first selectonemenu 'countryGroup' changes this is working
<f:ajax execute="@this" event="change" render="registerForm:regionGroup" />
And this causes to work this
After registerBacking.showRegions f:ajax renders registerForm:regionGroup which causes method getRegionSelectItems to look in database for new regions based on new country
Follow this approach. Probably it is what you need!
True person is moral, false is right!
Joined: Dec 12, 2007
Many thanks indeed for your detailed reply, and I'm sure it will be very helpful, particularly as you gave me an example which is similar to my problem. I agree with you that I put in too much information at once, which may have caused some confusion, and should have asked a question about one specific problem at a time.
Basically, I wanted to get the application working without Ajax in the first instance, then put in Ajax to make it work much better. The original version of my code can be found by going first to:
I am also seriously thinking of using PrimeFaces, and have played around with some simple tests, but first I need to get some experience with Ajax.
subject: JSF 2.0 - Ajaxification of listboxes and menus