Results 1 to 6 of 6

Thread: How to get EL on Java 1.4

  1. #1
    Join Date
    Aug 2008
    Posts
    10

    Default How to get EL on Java 1.4

    We are using Spring Web Flow in a Java 1.4 environment in which we also run Facelets. Facelets uses Sun's reference implementation of EL. We would like Spring Web Flow to use the same EL implementation, so our EL expressions look the same throughout all of our code.

    I know that officially only JBoss EL and OGNL is supported, however, JBoss EL requires Java 1.5 which is not available to us and OGNL is a language of its own (not EL).

    Has anyone got any experience with getting a plain EL implementation (Sun's or someone else's) working with Spring Web Flow?

    I am currently trying to get Spring Web Flow to use Sun's reference implementation but it turns out that a lot of the EL integration code in the spring-beans.jar is Java 1.5 only, so integrating the Sun RI seems to require some extra code.

    Yours

    Randahl

  2. #2
    Join Date
    Aug 2008
    Posts
    10

    Default

    I am curious - is everyone else in here running web flow on Java 5+ ?

    R.

  3. #3
    Join Date
    Oct 2005
    Location
    Cleveland, Ohio
    Posts
    73

    Exclamation What's the fuss?

    I am using OGNL 2.6.9 with Java 1.4 and the syntax works just like documented in the SWF 2 Reference Guide. So what's all the fuss?...
    John Mikich
    ~ Life is a journey, enjoy your ride! ~

  4. #4
    Join Date
    Aug 2008
    Posts
    10

    Default

    The problem is OGNL is not unified EL, and I would like my organisation to use the same EL implementation in their facelets view files and their web flow files.

    Out of the box facelets uses Sun's reference implementation of EL, while Spring Web Flow uses OGNL. This means that the same expression may have two different meanings dependent on what file you are in. This is error prone.

    Yours

    Randahl

  5. #5
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    You can configure a custom expression parser in the <faces:flow-builder-services> element. You could potentially wire up the WebFlowELExpressionParser using the ExpressionFactory from a 1.4 compatible version of the EL RI.

    The drawback to this is that you will lose the ability to invoke methods from your expressions (method invocation is an extended feature of JBoss EL), so you will not be able to use the <evaluate> action to its fully intended extent.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  6. #6
    Join Date
    Aug 2008
    Posts
    10

    Default

    Thank you for a nice suggestion, but that is also exactly what I have done. The problem is when using the web flow expression parser with another EL implementation, the parser references classes in spring-beans.jar which are compiled with Java 5. Most of spring-beans.jar is Java 1.4 compiled, however, some classes like SpringBeanELResolver have actually been compiled with Java 5 (you can confirm this using a hex viewer on the class and by looking at the class version after the CAFE BABE magic number - the value is 0x31 for SpringBeanELResolver and 0x30 for the Java 1.4 classes).

    I even downloaded the spring-beans.jar sources and tried to compile them for Java 1.4 myself, but it turns out, that some of the spring developers have implemented dependencies on Java 5 only methods. For instance, one class from spring-beans.jar invokes Class.isEnum which we all know was not available before the enum keyword was introduced. There may be sound reasons for this which I could have overlooked, but my current notion is that, one or more spring developers may have introduced these dependencies by accident. At least the Class.isEnum call could easily have been made Java 1.4 compatible using reflection instead of the Java 5 method. If someone can think of any good reason whatsoever for the troublesome Java 1.4 incompatibility I am all ears. As it stands, I suggest the spring team start listing Java 5 as a system requirement, thereby making it clear to Java 1.4 developers that using (parts of) the spring features on Java 1.4 is a no go.

    Yours

    Randahl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •