1
2
3
4 package org.rcfaces.core.internal.tools;
5
6 import javax.el.MethodExpression;
7 import javax.faces.FacesException;
8 import javax.faces.application.Application;
9 import javax.faces.application.NavigationHandler;
10 import javax.faces.component.UICommand;
11 import javax.faces.context.FacesContext;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15
16
17
18
19
20
21 public class ComponentTools0 {
22 private static final String REVISION = "$Revision: 1.1 $";
23
24 private static final Log LOG = LogFactory.getLog(ComponentTools0.class);
25
26 protected static void broadcastActionCommand(FacesContext facesContext,
27 UICommand component) {
28 String outcome = null;
29
30 MethodExpression binding = component.getActionExpression();
31 if (binding != null) {
32 try {
33 Object invokeResult = binding.invoke(facesContext
34 .getELContext(), null);
35
36 if (invokeResult != null) {
37 outcome = invokeResult.toString();
38 }
39
40 } catch (RuntimeException ex) {
41 throw ex;
42
43 } catch (Exception e) {
44 LOG.error(e);
45
46 throw new FacesException(binding.getExpressionString() + ": "
47 + e.getMessage(), e);
48 }
49 }
50
51 Application application = facesContext.getApplication();
52
53
54
55 NavigationHandler navHandler = application.getNavigationHandler();
56
57
58
59 navHandler.handleNavigation(facesContext, (null != binding) ? binding
60 .getExpressionString() : null, outcome);
61
62
63 facesContext.renderResponse();
64
65 }
66
67 }