• 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

logic:iterate not working

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

for some weird reason the following piece of code doesn't work

<logic:iterate id="level2" name="navigation" property="navVO.secondLevel">
<bean:write name="level2" property="title"/>
</logic:iterate>

When i run this, the JSP throws an error saying
"The bean level2 cannot be found in any scope"

all the value objects are defined, and are available, b'coz when i print the collection secondLevel in the JSP all the 20 objects are displayed.

there are 20 objects in that collection.

when i replace the bean:write tag with any normal text then the loop gets executed only once.

any ideas?

Seshu
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

when i print the collection secondLevel in the JSP all the 20 objects are displayed.



Could you show this code from your jsp that works???

It will be a good context for writing up how logic:iterate will work for your situation.
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here's the code that worked. basically i checked whether the collection secondLevel is having any collection items or not.

here's the code:

<bean:write name="navigation" property="navVO.secondLevel"/>

this printed all the 20 objects present in the collection secondLevel

-Seshu
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem just like yours.

My code is :



the error message is :
Cannot find bean element in any scope

any ideas?
thanks.

[ May 27, 2004: Message edited by: Grady Jamyson ]
[ May 27, 2004: Message edited by: Grady Jamyson ]
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Grady,

I could not get any ideas on how to solve this problem. The problem could be because we are using a bean defined using request.setAttribute() instead of using the form bean.

I solved the problem by using JSP scriptlet code in the JSP.

But that is not a good solution. If u have any ideas please lemme know. you can contact me at getvaranasi_sg@yahoo.com

-Seshu
 
Grady Jamyson
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found my problem of the codes.
I didn't put the taglib code into the code.

the following codes work fine

 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks grady, including the struts-logic.tld taglib did the trick

-Seshu
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic