In some cases, HTML elements still need to be used in JSF due to certain limitations.
But HTML component is lack of AJAX support.
Thus, the objective of this post is to show how to add AJAX event to a HTML element without writing any javascript.
this can be achieved with <a4j:jsFunction /> in Richfaces and <p:remoteCommand /> in Primefaces.
Steps:
1. Define the AJAX action to be invoked in xhtml.
(a) Richfaces
(b) Primefaces
2. invoke the AJAX action in HTML element.
Done!!
But HTML component is lack of AJAX support.
Thus, the objective of this post is to show how to add AJAX event to a HTML element without writing any javascript.
this can be achieved with <a4j:jsFunction /> in Richfaces and <p:remoteCommand /> in Primefaces.
Steps:
1. Define the AJAX action to be invoked in xhtml.
(a) Richfaces
<a4j:jsFunction
name="updateIndexWhenOnclick"
action="#{testBean.updateIndex}"
render="[component id to render]">
</a4j:jsFunction>
(b) Primefaces
<p:remoteCommand
name="updateIndexWhenOnclick"
action="#{testBean.updateIndex}"
update="[component id to update]">
</p:remoteCommand>
2. invoke the AJAX action in HTML element.
<input type="checkbox" onclick="updateIndexWhenOnclick();" />
Done!!
Thank you very much for this useful article. I like it. write essays for money
ReplyDeleteI enjoy your writing style really enjoying this web site . website design company nyc
ReplyDeleteWow really glad i came across your internet site, i??ll be sure to visit back now i??ve bookmarked it??. web design new york
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteUsually I don’t read this kind of stuff, but this was really interesting! branding agency sf
ReplyDeleteYou got a very fantastic website, Glad I observed it through yahoo. design agency san francisco
ReplyDeletesite promotion will always be a tedious job but you can outsource site promotion on some indian or pakistani guy- los angeles web agency
ReplyDeleteevery sales manager and store owner should have a training in sales management* la web design
ReplyDeletethe travel packages that i have seen on the internet are sometimes oversold, they are cheap yet the inclusions sucks` web design agency los angeles
ReplyDeleteVery informative post. Your current Website style is awesome as well! website design agency
ReplyDeleteAdding AJAX to web pages has never been easier for us than it is now. And I give you credit for making it easy. You are absolutely wise man. Dissertation Writing Service
ReplyDelete