• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Indexed Properties with List of Strings

 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic