How does Ajax work on JSF?

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

I am new to JSF, but I have some experience with ASP.NET and its Ajax features. I know that JSF has some Ajax tags that can do some duties with Ajax, but I wonder how it uses Ajax. Does it use something like ScriptManager in ASP.NET?

回答1:

Whenever you use the JSF <f:ajax> tag, the jsf.js script will be auto-included in the HTML head. It will take care about all the ajax magic. The on* attributes of the generated HTML elements will where necessary be altered that way so that it uses the ajax script rightly. You don't need to worry about this all, all you need to do is to specify and use the JSF <f:ajax> tag as documented. You don't need to manually include and configure the script like as ASP.NET ScriptManager.

Note that this only works when you use Facelets as view technology, not its ancient predecesor JSP. You also need to make sure that you've a <h:head> instead of plain HTML <head> in the master template, otherwise JSF won't be able to auto-include the jsf.js script.

All with all, JSF ultimately generates plain HTML. Just open page in browser, rightclick and View Source. If you are well familiar with basic HTML and JS, everything will be obvious.



转载请标明出处:How does Ajax work on JSF?
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!