Announcement Announcement Module
Collapse
No announcement yet.
simple question about using p schema shortcut Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • simple question about using p schema shortcut

    Hi, I couldnt find this in the doc. How would one declare list or arrays in the bean declaration using the p notation. For example I'm currently doing something like this:

    p:size="4"
    p:weight="55">
    <property name="kids">
    <list>
    <value>john</value>
    <value>susie</value>
    </list>
    </property>
    </bean>

    because this doesnt work: p:kids="john,susie"

    Is there a way to use the p shortcut with lists? thanks

  • #2
    Unless something was added in 3.0 that I missed, there's no way to use the p-schema with collections. I typically just do the same thing you showed.

    Keep in mind, though, that Spring has the shortcut that lets you specify a single-element list as that element, so if I only had one kid, I could conceivably use p:kids="john".

    Hope this helps
    - Don

    Comment


    • #3
      Following is the only solution i can think of,

      Code:
      	<bean name="bean" class="com.example.Person" p:name="John Doe"
      		p:kids-ref="kids" />
      
      	<util:list id="kids" list-class="java.util.ArrayList">
      		<value>Smith</value>
      		<value>Mark</value>
      	</util:list>

      Comment


      • #4
        because this doesnt work: p:kids="john,susie"

        Is there a way to use the p shortcut with lists? thanks
        If kids is a array it will work.

        Comment

        Working...
        X