Announcement Announcement Module
Collapse
No announcement yet.
util:properties versus util:map Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • util:properties versus util:map

    How is it that this exists:

    Code:
    <util:properties id="whatever">
        <prop key="1">Spring is easy.</prop>
        <prop key="2">Spring is useful.</prop>
        <prop key="3">Spring is fun to learn.</prop>
    </util:properties>
    But this does not?

    Code:
    <util:map id="whatever">
        <entry key="1">Spring is easy.</entry>
        <entry key="2">Spring is useful.</entry>
        <entry key="3">Spring is fun to learn.</entry>
    </util:map>
    I need a HashMap, not a Hashtable/Properties object.

    What I really want is this:

    Code:
    <util:map id="myQueryMap">
        <entry key="query1"><[!CDATA[ select id from table when id > 1]]></entry>
    </util:map>
    Last edited by lukasbradley; Dec 18th, 2012, 10:19 PM.

  • #2
    I strongly suggest a read of the reference guide. util:map does exists so not sure why you think it doesn't?!

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      I strongly suggest a read of the reference guide. util:map does exists so not sure why you think it doesn't?!
      How very..... PRAGMATIC.... of you.

      Of course util:map exists. What does not exist is the ability to embed values in the body of an entry element.

      HOWEVER, I found the following, that does work. You just need to use value elements (although, they seem superfluous to me).

      Code:
      <util:map id="whatever">
          <entry key="1"><value>Spring is easy.</value></entry>
          <entry key="2"><value>Spring is useful.</value></entry>
          <entry key="3"><value>Spring is fun to learn.</value></entry>
      </util:map>

      Comment


      • #4
        Of course util:map exists. What does not exist is the ability to embed values in the body of an entry element.
        There is as you already figured out yourself.

        HOWEVER, I found the following, that does work. You just need to use value elements (although, they seem superfluous to me).
        No they aren't... A Map in constrast to a Properties object can contain anything as a value a Properties object only holds Strings. So there could be anything between the entry elements and there needs to be distinguisted between a value and a ref and hence the need for a value element.

        Also what is wrong with simply using the value attribute?! Should work without any problems.

        Comment

        Working...
        X