IntelliJ Java IDE
The moose likes Struts and the fly likes logic:iterate not working Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply Bookmark "logic:iterate not working" Watch "logic:iterate not working" New topic
Author

logic:iterate not working

Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
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


Sree Jag<br />SCJP 1.4
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4695

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.


A good workman is known by his tools.
Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
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
Grady Jamyson
Ranch Hand

Joined: Aug 04, 2002
Posts: 41
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

Joined: Oct 14, 2003
Posts: 77
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

Joined: Aug 04, 2002
Posts: 41
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

Joined: Oct 14, 2003
Posts: 77
Thanks grady, including the struts-logic.tld taglib did the trick

-Seshu
 
 
subject: logic:iterate not working
 
Threads others viewed
STRUTS: Iterating over a collection of ActionErrors
Cannot find bean in any scope...
logic:match , logic:notEqual not working
problem with logic:iterate
Iterating over a map in JSP using struts
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture