Hi,
I use a global action-listener defined in faces-config via the action-listener
tag to log called actions/actionsListeners.
With JSF 1.1 I used following code:
private void storeCalledAction(ActionEvent actionEvent){
ActionSource actionSource = (ActionSource) actionEvent.getComponent();
//1. check for action listener
MethodBinding methodBinding = actionSource.getActionListener();
if (methodBinding == null){
//2. check for action
methodBinding = actionSource.getAction();
}
if (methodBinding != null){
action = methodBinding.getExpressionString();
...
MethodBinding is deprecated in JSF1.2 and also null for actionListeners.
Therefore I changed ActionSource to ActionSource2 and MethodBinding to
MethodExpression.
private void storeCalledAction(final ActionEvent actionEvent){
ActionSource2 actionSource = (ActionSource2) actionEvent.getComponent();
MethodExpression methodExpression = actionSource.getActionExpression();
if (methodExpression==null){
ActionListener[] actionListeners = actionSource.getActionListeners();
if (actionListeners!=null && actionListeners.length>0){
ActionListener lastActionListener =
actionListeners[actionListeners.length-1];
//???? And now???
}
}
How can I access the methodExpression of the (now nested) ActionListeners?
They are of type javax.faces.event.MethodExpressionActionListener but there is
no getter available.
Do I have to patch MethodExpressionActionListener locally and add a getter or
is there an official alternative?
Michael