Skip to content Skip to sidebar Skip to footer

Using Jsf Ajax Methods To Keep Javascript Module Scope

I am working with the application, which has JSF2 framework. The idea of that framework is to manage connection between Backend (Java) and Frontend. I know, that JSF version we are

Solution 1:

If you need an ajax component to post/retrieve arbitrary data from the server then I don't think jsf.ajax is the right tool for you. It is strictly coupled to the JSF presentation and can be used to invoke the server logic and render parts of the html page. The response will be an XML with partial-updates. Below I will describe how to bend it towards your purpose but it won't be intended application of this api.

In short this would have to be called like:

jsf.ajax.request(<DOM_node>, event, {render: "<rendered_id>", execute: "@this"})

Where DOM_node is element which has an action listener, event is JS event of type supported by the listener (if you use jsf.ajax.request as onclick then just "event" variable will be available and you can pass it as is). <rendered_id> should be client id of JSF component surrounding the script you want to execute as a callback.

The resulting call should ask JSF to execute action listener attached to component corresponding to DOM_node (like commandLink) and rerender area contained within component with <rendered_id>. If it contains html <script> tag, this script will be executed. It can contain your JSON data and function calls.

Here is a link to the docs.

Post a Comment for "Using Jsf Ajax Methods To Keep Javascript Module Scope"