Sorry, I still did not explain my code very well.

I am trying to write out the properties of ThreadBean
in a "while loop" in my JSP:

<%
Collection threadRows = ( Collection
)request.getAttribute( "ThreadBeans" );

int odd = 0;
   Iterator iterator = threadRows.iterator();
   while( iterator.hasNext() ) 
   {
      odd = ( odd + 1 )%2;
      ThreadBean threadBean = ( ThreadBean
)iterator.next();

      .....
      .....

      <%=threadBean.getSender()%> > 
      <%=threadBean.getThreadReplyCount()%> > 
      <%=threadBean.getThreadViewCount()%> 
   }
%>
 
and the error is that cannot find threadBean in any
scope.

ThreadBeans is a collection, which is created in a
java class that extends Action.  And ThreadBeans are
passed in a request scope into my JSP.

ThreadBeans, which is a collection of JavaBean(s). 
Each of those JavaBean(s) is a ThreadBean with many
properties to be written out in a loop.  The
ThreadBean is in a package.

In my JSP scriplet, I retrieve the collection of those
JavaBean(s) from the request scope.  

Then, I enter the while loop to write out the
properties of each of those JavaBean(s).

What should I do so that my JSP knows threadBean is in
the request scope?

Thank you.

-Caroline

--- Christopher Schultz
<[EMAIL PROTECTED]> wrote:
> Caroline,
> 
> Wait a second...
> 
> > Collection threadRows = ( Collection
> > )request.getAttribute( "ThreadBeans" );
> > 
> > int odd = 0;
> >    Iterator iterator = threadRows.iterator();
> >    while( iterator.hasNext() ) 
> >    {
> >       odd = ( odd + 1 )%2;
> >       ThreadBean threadBean = ( ThreadBean
> > )iterator.next();
> > 
> >       .....
> >    }
> > %>
> > 
> > 5. when I tried to write out the properties; for
> > example:
> > 
> > <%=threadBean.getSender()%>
> > <%=threadBean.getThreadReplyCount()%>
> > <%=threadBean.getThreadViewCount()%>
> 
> This message doesn't look like it's coming from this
> body of code. Are 
> you mixing scriptlets (as above) with 'bean' tags?
> 
> If so, you're mixing apples and oranges, since the
> bean tag doesn't do 
> anything with "local" variables created by scriptlet
> code.
> 
> Are you sure you don't have something like this
> anywhere:
> 
> <bean:write name="threadBean" property="name" />
> 
> If so, you'll have to put your object into some
> scope (page or request, 
> maybe) before using it with the bean tags. That's a
> bit sloppy, though, 
> and I'll recommend again that you stick to using the
> taglibs exclusively 
> rather than scriptlets.
> 
> -chris
> 

> ATTACHMENT part 2 application/pgp-signature
name=signature.asc




        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to