It's not a secret anymore!*
The moose likes Struts and the fly likes Array not recognized in logic:iterate tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Array not recognized in logic:iterate tag" Watch "Array not recognized in logic:iterate tag" New topic
Author

Array not recognized in logic:iterate tag

Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
I'm having a problem with a html:multibox tag inside a logic:iterate tag. When the page is entered, I get the following error: "Null attribute name".

Some pieces of my code:
The form bean:

A piece of my jsp page:

As you can see, I'd like to use a String array in my form bean to be iterated on my jsp page. Any ideas why this error message is shown? Why doesn't it recognize the array?

Thanks!


SCJP 1.5, SCWCD 1.4, SCBCD 5
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
While any of the <html:xxx> tags automatically assume the name attribute to be the ActionForm bean name, the <logic:iterate> tag does not.

Change your <logic:iterate> tag to:

<logic:iterate id="apps" name="myForm" property="items">

where "myForm" is the name of your ActionForm bean.
[ July 31, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
Thanks for that! Again a very useful answer from your side!
 
jQuery in Action, 2nd edition
 
subject: Array not recognized in logic:iterate tag