当前位置: 首页 > 工具软件 > JQuery4JSF > 使用案例 >

jsf ajax action,Call JSF action thru jQuery ajax

督坚白
2023-12-01

问题

How to call a JSF action method thru jQuery AJAX?

回答1:

Calling a JSF view directly through AJAX is unwise unless your JSF stack supports AJAX and you know how to construct the request in such a way that the stack understands. Mistakes here can result in problems with the view state and difficult to diagnose errors.

Core JSF 1.2 (and before) does not have direct AJAX support; 3rd party frameworks provide varying degrees of AJAX support. JSF 2 adds AJAX JavaScript libraries to the core framework (David Geary demonstrates), so use that if possible.

One way round all this is to use a servlet to interact with the model directly (i.e. not posting back to the JSP/Facelet view). This may be adequate, depending on exactly what you are doing.

回答2:

Have you tried using the data attribute of a4j:jsFunction to return a value? This will mimic a sync call.

eg.

来源:https://stackoverflow.com/questions/1476639/call-jsf-action-thru-jquery-ajax

 类似资料:

相关阅读

相关文章

相关问答