"Javing" is the present continuous form of "to program in Java".
Here you will find: code snippets, examples, tips, tricks, tutorials, best practices, miscellaneous and much more.
Enjoy your Javing!

Sunday, February 13, 2011

Adding very basic AJAX Support to our JSF 2.x pages.

The last couple of days i tried to find out how to add AJAX support to my JSF UI components, so i can update them without refreshing the page... and also because other benefits of using AJAX.

A couple of guys from stackOverflow helped me out, and it was a complete success.

1-This is the selectOneMenu where the user picks a desired item

<h:selectOneMenu value="#{searchController.selectedCategory}"><f:selectItems value="#{searchController.formatedCategories()}"></f:selectItems><!-- in f:ajax listener is not needed, but we can add it if we need it --><f:ajax event="change" execute="@this" listener="#{searchController.selectedCategoryMenu}"render="menuType" /></h:selectOneMenu>

2-This is how the new element that needs to be rendered looks like(The rendered attribute controls when each panel should be rendered)

Contact me

Name

Email
*

Message
*

About javing

I want to welcome you to my blog.My name is Djordje Popovic, I am a Software Craftsman and an enthusiast of the java programming language.

In 2011 I decided to create javing just as a way to keep track of my studies on the java programming language and also provide support to other fellow students. This blog has being here since the beginning of my career as a programmer. Fell free to make comments or critics to my entries, ill be happy to read them and answer to you.