Skip to content Skip to sidebar Skip to footer

How To Add Js Effects On Rendering Ajax Parts In Jsf2?

In JSF2, I can update part of view by AJAX. I assume part of components tree is just generated/updated on server, rendered to HTML and this HTML is sent to client. Then inserted in

Solution 1:

It's easy if you use Primefaces:

http://www.primefaces.org/showcase/ui/effects.jsf

Otherwise you could use the onevent attribute of the f:ajax tag, which accepts a Javascript function name as the value. This function will be called three times during an AJAX request: with begin, complete and success set in the function parameter's status field.

Check page 355 of "Java Server Faces 2.0 - The Complete Reference" for further info.

You can see a working example here:

http://www.ibm.com/developerworks/java/library/j-jsf2fu3/index.html

UPDATE: From the Primefaces users guide:

Effects can also be applied to any JSF component when page is loaded for the first time or after an ajax request is completed. Following example animates messages with pulsate effect after ajax request.

<p:messagesid="messages"><p:effecttype="pulsate"event="load"><f:paramname="mode"value="'show'" /></p:effect></p:messages><p:commandButtonvalue="Save"actionListener="#{bean.action}"update="messages"/>

Post a Comment for "How To Add Js Effects On Rendering Ajax Parts In Jsf2?"