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

jstl: Expression.evaluate versus ExpressionEvaluator.evaluate  RSS feed

 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Reading the jstl API, I noticed the method ExpressionEvaluator.evaluate().
On the other hand, ExpressionEvaluator can also return an Expression, which has its own evaluation method Expression.evaluate().
Isn't this redundant ? Which method would be used on which occasion ?

Also, I was wondering: do I understand correctly, that one could override the ExpressionEvaluator ? So if I write my own evaluator, I could make it so that "${2+2}" evaluates to, say, "5" ?

Thanks very much.
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I expect you could override it like any any other J2EE API method - but obviously it would be a bad bad idea.

If you need to use "custom" EL behaviour consider using static EL functions (like tag libraries)
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!