• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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: 26263
186
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.
 
New rule: no elephants at the chess tournament. Tiny ads are still okay.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic