YOU 'DA MAN!

I forgot something so *&@# simple!  As soon as I added the taglib directive,
I was able to successfully iterate.

Thanks so much for hanging on and helping me out..

Aaron

-----Original Message-----
From: Bill Clinton [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 07, 2001 8:06 AM
To: [EMAIL PROTECTED]
Subject: Re: Examples anyone?


Aaron,

     Lets go back to your second error, the 
"javax.servlet.ServletException: Cannot find bean task in scope null". 
 I can simulate this if, in one of the pages where I use an iteration in 
this manner, I remove or modify the tag definition.   Are you absolutely 
sure that you have the

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

tag definition in your page?  and that the prefix "logic" is the same in 
the tag definition?  This would account for "workman" being printed only 
once and getting a null pointer when you refered to the "task" iteration id.

Bill



Aaron O'Hara wrote:

>The following is my code in the <body> tags:
>
>The tasks for me:
><%=general.getTasks().size() %>
><logic:iterate id="task" name="general" property="tasks">
>  workman! <br>
></logic:iterate>
>
>The scriptlet asking for size returns 3, but the text "workman!" appears
>only once.
>
>Any other ideas?
>
>Aaron
>
>-----Original Message-----
>From: Bill Clinton [mailto:[EMAIL PROTECTED]]
>Sent: Friday, September 07, 2001 7:15 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Examples anyone?
>
>
>Aaron,
>     I am not sure why you are getting that error.  I have never needed 
>to use a "bean:define" or "jsp:useBean"  to define the object being 
>iterated over.   It seems your collection (getTasks()) is being found, 
>or you would get an error like this:
>
>javax.servlet.jsp.JspException: No collection found
>
>Here is what I would try: remove the "bean:write" and put in something 
>like "hello". Does this get printed x number of times (x being the 
>number of task objects in your iteration)?  If so, try putting <%= task 
>%> inside your iteration.  Does it print out something like : 
>com.razorfront.corporate.task.Task@2b835a , x number of times?
>
>Bill
>
>
>Keith Bacon wrote:
>
>>Maybe you need to use the struts tag 
>><bean:define
>>
>>not 
>><jsp:useBean
>>
>>Keith,
>>
>>
>>--- Aaron O'Hara <[EMAIL PROTECTED]> wrote:
>>
>>>If I take out the useBean for task I get the following error:
>>>
>>>javax.servlet.ServletException: Cannot find bean task in scope null
>>>
>>>Any suggestions?
>>>
>>>Aaron
>>>
>>>-----Original Message-----
>>>From: Bill Clinton [mailto:[EMAIL PROTECTED]]
>>>Sent: Thursday, September 06, 2001 2:53 PM
>>>To: [EMAIL PROTECTED]
>>>Subject: Re: Examples anyone?
>>>
>>>
>>>Aaron,
>>>     I believe the code you have should be accurate, but leave out
>>>the 
>>>usebean directive for task (which isn't necessary and I think is 
>>>interfering with your iteration id because it has the same id):
>>>
>>><jsp:useBean id="general" scope="application"
>>>class="com.razorfront.corporate.global.General"/> 
>>>
>>><logic:iterate id="task" name="general" property="tasks">
>>> <bean:write name="task" property="subject"/> <br>
>>></logic:iterate>
>>>
>>>this is assuming:
>>>1) the method in General that returns the Arraylist is getTasks().
>>>2) there is a method in Task called getSubject()
>>>
>>>Hope that helps,
>>>Bill
>>>
>>>
>>>
>>>Aaron O'Hara wrote:
>>>
>>>>All,
>>>>
>>>>Would somebody be able to point me to an example of iteration with
>>>>
>>>the
>>>
>>>>following environmental "restrictions"?  I've looked at sample
>>>>
>>>code, but
>>>
>>>>nothing seems to meet 100% what I'm trying to do and I'm still
>>>>
>>>tearing my
>>>
>>>>head out trying get get it to work.
>>>>
>>>>I have an application scope bean with a getMethod() that returns a
>>>>
>>>List
>>>
>>>>which is actually an ArrayList of "Task" objects.  I want to
>>>>
>>>iterate
>>>through
>>>
>>>>this List and display properties of the Task object using the
>>>>
>>>getter
>>>
>>>>methods.
>>>>
>>>>In an unsuccessful attempt, I've tried:
>>>>
>>>><jsp:useBean id="general" scope="application"
>>>>class="com.razorfront.corporate.global.General"/>
>>>><jsp:useBean id="task" scope="page"
>>>>class="com.razorfront.corporate.task.Task"/>
>>>>
>>>><logic:iterate id="task" name="general" property="tasks">
>>>><bean:write name="task" property="subject"/> <br>
>>>></logic:iterate>
>>>>
>>>>(I've omitted the taglib statements for brevity)
>>>>
>>>>I've seen examples using HaspMaps and Lists of numbers, but not a
>>>>
>>>List of
>>>
>>>>Objects.  Any assistance would be greatly appreciated!
>>>>
>>>>Aaron
>>>>
>>>>.
>>>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Get email alerts & NEW webcam video instant messaging with Yahoo!
Messenger
>>http://im.yahoo.com
>>
>>.
>>
>
>
>.
>

Reply via email to