Win a copy of Murach's Python Programming this week in the Jython/Python 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: 18531
61
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!