Results 1 to 4 of 4

Thread: Problem with resourceBundle EL variable

  1. #1
    Join Date
    Oct 2008
    Posts
    22

    Default Problem with resourceBundle EL variable

    I have problems using the predefined resourceBundle EL variable when the properties are named using dot notation.



    This works fine
    <action-state id="...">
    <evaluate expression="someAction.say(resourceBundle.simplePr operty)"/>
    ...
    </action-state>


    This doesn't work
    <action-state id="...">
    <evaluate expression="someAction.say(resourceBundle.not.a.si mple.property)" />
    ...
    </action-state>


    So my question is:
    How do I get the value for the property named 'not.a.simple.property' using the EL resourceBundle variable?

  2. #2

    Default

    If your property contains dots, you have to use this syntax:

    Code:
    #{resourceBundle['my.property.containing.dots']}
    To avoid confusion, you just might want to always use this syntax. Beware not to forget the '' -- otherwise you won't get an error message, it just won't display a String as far as I remember.
    Spring 2.5.6, Spring WebFlow 2.0.8, MyFaces 1.2.5, Facelets, JDK 1.6.0, Tomcat 6

  3. #3
    Join Date
    Oct 2008
    Posts
    22

    Default Ok, and if...

    Thanks...

    I will try that.

    What if isīs part of a bigger expression...

    <evaluate expression='action.method(resourceBundle.my.qualif ied.prop) />

    Cheers

  4. #4

    Default

    Right now, I'm not sure if this would work:

    Code:
    <evaluate expression='action.method(resourceBundle['my.qualified.prop']) />
    If it doesn't, you might have to save the value in another var first.

    Code:
    <set var="my_property" value="resourceBundle['my.qualified.prop']"/>
    <evaluate expression='action.method(my_property) />
    But honestly, I never know what works and what doesn't without trying with JSF and Web Flow. Trial and error, all the day...
    Spring 2.5.6, Spring WebFlow 2.0.8, MyFaces 1.2.5, Facelets, JDK 1.6.0, Tomcat 6

Posting Permissions

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