Start Execution in Foreign Ajax Channel
From Documentation
Employment/Purpose
Here describes how to start a ZK execution in a foreign Ajax channel. For example, JSF 2 allows developers to send back JavaScript code to update the browser in JSF's Ajax channel[1].
- ↑ For more information, please refer to Introducing JSF 2 Client Behaviors
Example
Start Execution in JSF 2 Client Behaviors
For example, with JSF 2, you could do as follows.
<syntax lang="java"> public class MyCustomBehavior extends ClientBehaviorBase {
@Override public String getScript(ClientBehaviorContext bc) { ExternalContext ec = bc.getFacesContext().getExternalContext(); ServletContext svlctx = (ServletContext)ec.getContext(); HttpServletRequest request = (HttpServletRequest)ec.getRequest(); HttpServletResponse response = (HttpServletRersponse)ec.getResponse();
Component comp = getComponent(); Bridge bridge = Bridge.start(svlctx, request, response, comp.getDesktop()); try { //...do whatever you want comp.appendChild(new Label("custom behavior triggered")); return bridge.getResult(); } finally { bridge.close(); } } private Component getComponent() { //locate the component that you want to handle }
} </syntax>
Version History
Version | Date | Content |
---|---|---|
5.0.5 | September 2010 | Bridge was introduced to simplify the starting of an execution in foreign Ajax channel |