开发者

how do i call a jsf action method (in JSF 1.2) using Ajax?

开发者 https://www.devze.com 2023-01-12 11:59 出处:网络
I am writing a JSF 1.2 Application in Apache My faces. I cannot use any customized component library - like tomahawk or a4j and others. Is there a way to call an action method 开发者_开发百科of JSF us

I am writing a JSF 1.2 Application in Apache My faces. I cannot use any customized component library - like tomahawk or a4j and others. Is there a way to call an action method 开发者_开发百科of JSF using Ajax? When the JSF action is done , I would like to handle the response of the JSF action by Javascript and populate a DIV Tag in the Client side ? Is it possible? Thanks.


JSF 1.2 does not provide any builtin ajax facilities. You have basically 2 options:

  1. Homegrow an ajaxical component library. It isn't that easy since you've to take the JSF lifecycle and component tree into account while handling ajaxical requests. It would also end up to take much more time than using an existing ajaxical component library.

  2. Use an existing ajaxical component library. The simplest one would be Ajax4jsf (pure ajax tags, no UI components, it's much like <f:ajax> in JSF 2.0). This is part of RichFaces, but you can also download and install it separately without the need for the whole RichFaces component library around it. This would be my recommendation. You can find the developer documentation here and download the library here.

0

精彩评论

暂无评论...
验证码 换一张
取 消