• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AddActionListener From parameter as exression

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic