• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Indexed Properties with List of Strings

 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to get an indexed properties example working where my form contains a List of String object but I could not. Here is my form and the method signatures:


I have tried a couple things in the jsp, but here is what seems to be the closest:


This causes this error when the page is displayed:

No getter method for property: "phoneItem" of bean: "my.examples.indexed.SimpleIndexedForm"

If I build the index myself using some scriptlet code, it works fine.


Got any tips on making this work?

- Brent
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is that indexed="true" works only for a List or array of JavaBeans. It does not work for a String array. For that, one has to do as you have done and manually construct the indexed property using either scriptlets or EL expressions.
[ October 15, 2007: Message edited by: Merrill Higginson ]
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is all I could figure out as well...just wanted to make sure that I was not missing something. I played around with my sample code and the best solution that I could come up for someone that really wanted to use the indexed="true" setting is to create a StringWrapper class that just had a String property named value.

On a side note...I should play around more with Struts EL. It is looking like my project will be stuck with JSP 1.2 support for a while and there are plenty of places where using EL would be handy.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic