Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AddActionListener From parameter as exression  RSS feed

 
Varun K. Gupta
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to set From parameter of AddActionListener with some expression..

SetActionListener listener = new SetActionListener();

listener.setFrom("#{node.id}");

ValueExpression valueEx = facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), "#{myBean.id}", Boolean.class);
actionListerParameter.setValueExpression("to", valueEx);

The code is not getting evaluated at runtime. it is taking it as string #{node.id}

I am getting exception
java.lang.IllegalArgumentException: Cannot convert ValueExpression[#{node.id}] of type class com.sun.el.ValueExpressionImpl to class java.lang.Long
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Listeners are used excessively where they are neither needed nor optimal by too many people. I think that this came about because out-of-date documentation from when JSF was still being shaped floated around the web for years after it should have been discarded.

2. My #1 rule for JSF is always that if you resort to using any javax.faces classes or methods other than javax.faces.model, there's a very strong chance you are doing something wrong.

Rather than frame a question in terms of a specific and very esoteric technical function, why not tell us what the actual intended effect in terms of the application and its user interface are supposed to be? Often there's a much simpler and cleaner solution that can be done with POJOs and basic JSF tag elements.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!