According to java ee 5 api ExpressionFactory
provides a method #newInstance
.
Well, javadoc is not a proof and, actually, this is very likely an error in the Java EE 5 javadoc. The two newInstance()
factory methods have been added in the Maintenance Review 1 of the JSR-245 (to make EL standalone and take it out of JSP 2.1, have a look at the JSR-245 MR1 Change Log for the details) but that review has never been released.
So it's not surprising that you don't find this method in the java-ee bundle available in the java.net repo.
But this jar does not provide this method. So I get compiler errors.
As expected. This method is not in Java EE 5 (at least this is my understanding). So you need to use:
ExpressionFactory factory = new ExpressionFactoryImpl();
The official JEE 6.0 jar provided by maven (java.dev.net) contains this method.
Yes, because this is Java EE 6, because EL is now standalone, with its own specification (technically, EL is still in JSR-245, sorry if this is confusing). So Java EE 6 includes EL 2.2 (yes, the version jumped from 1.1 to 2.1.2 and then 2.2 for a better alignment with the JSP version). And this version does expose the newInstance()
methods on ExpressionFactory
.