You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Conlin <me...@yahoo.com> on 2002/12/15 21:39:23 UTC

Iterate tag Tomcat 4.1.12, issue or no?

 
After much scanning of the user-list archive I have seen some mentions
of a problem with tomcat 4.1 and the <logic:iterate> tag.
I have also seen mentions of Tomcat 4.1.12 working fine with the logic
tag. Does a problem exist?
 
I am getting the following error, my code matches the example code in
the <logic> taglib guide, so I am out of ideas on what is wrong.
 
ERROR:
cannot resolve symbol symbol : variable myMessage
 
Code in JSP:
<%
      SessionUtility su = new SessionUtility();
      ArrayList messages = 
(ArrayList) su.getAttribute(session, HomeConstants.MESSAGE_ARRAY);
%>
 
<table>
<TR>
   <TD> 
<!--  Begin Display of Messages     -->               
            
<%= messages.size() %>
            
<logic:iterate id="myMessage" collection="<%=messages%>">
<%= myMessage.getSubject() %>
</logic:iterate>
 
If I remove the logic tag completely the messages.size() tells me that I
have two 
Objects in the array list, so I know the information is in there I just
can't get to it.
 
I have also tried this with the type="com.mysystem.bo.bean.Message" set
as well, still
It does not work.
 
Any Ideas?
 
Thank you for your help,
Mark 

RE: Iterate tag Tomcat 4.1.12, issue or no?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sun, 15 Dec 2002, Mark Conlin wrote:

> Date: Sun, 15 Dec 2002 19:15:48 -0500
> From: Mark Conlin <me...@yahoo.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: RE: Iterate tag Tomcat 4.1.12, issue or no?
>
>
> Okay, here is what did it.
>
> <logic:iterate id="myMess" name="messages">
> 	<bean:write name="myMess" property="subject"/>
> </logic:iterate>
>
> So I have to user bean taglib to access a bean inside of an interate tag
> ?
> I can't just access it by using <%= myMess.getSubject() %> ???
>
> I can live with that, I just don't understand why...
>

That's actually simple ... the <logic:iterate> tag does not create a
scripting variable.  It only stores the current element you are iterating
over in the attribute defined by "name".  Scripting variables are only
needed if you're going to use scriptlets or runtime expressions, and in
general that (especially scriptlets) is discouraged.

NOTE:  When you start using JSTL, you'll find that the iteration tags in
that library act the same way.

> Mark
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Mark Conlin <me...@yahoo.com>.
Okay, here is what did it.

<logic:iterate id="myMess" name="messages">  
	<bean:write name="myMess" property="subject"/>
</logic:iterate>

So I have to user bean taglib to access a bean inside of an interate tag
?
I can't just access it by using <%= myMess.getSubject() %> ???

I can live with that, I just don't understand why...

Mark




-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Sunday, December 15, 2002 6:59 PM
To: Struts Users Mailing List
Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?

You *do* have a taglib directive for the logic taglib in the page,
right?

Mark Conlin wrote:
> Thanks folks, but that does not work either. 
> 
> So I tried the code from the example in the struts developers Guide.
> It doesn't work either.
> 
> <%
> java.util.ArrayList list = new java.util.ArrayList();  
> list.add("First");  
> list.add("Second");  
> list.add("Third");  
> list.add("Fourth");  
> list.add("Fifth");  
> pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
> %>
> 
> <logic:iterate id="myCollectionElement" name="list">  
> Element Value: <bean:write name="myCollectionElement" />
> <br />
> </logic:iterate>
> 
> This code results in the following error:
> [ServletException in:admin/admin_home.jsp] 
> Cannot find bean myCollectionElement in any scope'
> 
> Any Ideas?
> 
> 
> 
> -----Original Message-----
> From: Kris Schneider [mailto:kris@dotech.com] 
> Sent: Sunday, December 15, 2002 4:47 PM
> To: Struts Users Mailing List
> Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
> 
> <%
>    SessionUtility su = new SessionUtility();
>    ArrayList messages =
>      (ArrayList)su.getAttribute(session, HomeConstants.MESSAGE_ARRAY);
>    pageContext.setAttribute("messages", messages);
> %>
> 
> <logic:iterate id="myMessage" name="messages">
> 
> Mark Conlin wrote:
> 
>>I am afraid that still does not work.
>>
>>None of these work....
>><logic:iterate id="myMessage" collection="<%=messages%>">
>><logic:iterate id="myMessage" collection=<%=messages%>>
>><logic:iterate id="myMessage" collection="messages">
>>
>>
>>-----Original Message-----
>>From: Rick Reumann [mailto:maillist@reumann.net] 
>>Sent: Sunday, December 15, 2002 7:22 PM
>>To: Struts Users Mailing List
>>Cc: meconlin@yahoo.com
>>Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
>>
>>On Sun, 15 Dec 2002 15:39:23 -0500
>>"Mark Conlin" <me...@yahoo.com> wrote:
>>              
>>
>>
>>><%= messages.size() %>
>>>           
>>><logic:iterate id="myMessage" collection="<%=messages%>">
>>><%= myMessage.getSubject() %>
>>></logic:iterate>
>>
>>
>>Try collection="messages" (without the scriplets).
>> 
>>
> 
> 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Kris Schneider <kr...@dotech.com>.
You *do* have a taglib directive for the logic taglib in the page, right?

Mark Conlin wrote:
> Thanks folks, but that does not work either. 
> 
> So I tried the code from the example in the struts developers Guide.
> It doesn't work either.
> 
> <%
> java.util.ArrayList list = new java.util.ArrayList();  
> list.add("First");  
> list.add("Second");  
> list.add("Third");  
> list.add("Fourth");  
> list.add("Fifth");  
> pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
> %>
> 
> <logic:iterate id="myCollectionElement" name="list">  
> Element Value: <bean:write name="myCollectionElement" />
> <br />
> </logic:iterate>
> 
> This code results in the following error:
> [ServletException in:admin/admin_home.jsp] 
> Cannot find bean myCollectionElement in any scope'
> 
> Any Ideas?
> 
> 
> 
> -----Original Message-----
> From: Kris Schneider [mailto:kris@dotech.com] 
> Sent: Sunday, December 15, 2002 4:47 PM
> To: Struts Users Mailing List
> Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
> 
> <%
>    SessionUtility su = new SessionUtility();
>    ArrayList messages =
>      (ArrayList)su.getAttribute(session, HomeConstants.MESSAGE_ARRAY);
>    pageContext.setAttribute("messages", messages);
> %>
> 
> <logic:iterate id="myMessage" name="messages">
> 
> Mark Conlin wrote:
> 
>>I am afraid that still does not work.
>>
>>None of these work....
>><logic:iterate id="myMessage" collection="<%=messages%>">
>><logic:iterate id="myMessage" collection=<%=messages%>>
>><logic:iterate id="myMessage" collection="messages">
>>
>>
>>-----Original Message-----
>>From: Rick Reumann [mailto:maillist@reumann.net] 
>>Sent: Sunday, December 15, 2002 7:22 PM
>>To: Struts Users Mailing List
>>Cc: meconlin@yahoo.com
>>Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
>>
>>On Sun, 15 Dec 2002 15:39:23 -0500
>>"Mark Conlin" <me...@yahoo.com> wrote:
>>              
>>
>>
>>><%= messages.size() %>
>>>           
>>><logic:iterate id="myMessage" collection="<%=messages%>">
>>><%= myMessage.getSubject() %>
>>></logic:iterate>
>>
>>
>>Try collection="messages" (without the scriplets).
>> 
>>
> 
> 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Mark Conlin <me...@yahoo.com>.
Thanks folks, but that does not work either. 

So I tried the code from the example in the struts developers Guide.
It doesn't work either.

<%
java.util.ArrayList list = new java.util.ArrayList();  
list.add("First");  
list.add("Second");  
list.add("Third");  
list.add("Fourth");  
list.add("Fifth");  
pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
%>

<logic:iterate id="myCollectionElement" name="list">  
Element Value: <bean:write name="myCollectionElement" />
<br />
</logic:iterate>

This code results in the following error:
[ServletException in:admin/admin_home.jsp] 
Cannot find bean myCollectionElement in any scope'

Any Ideas?



-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Sunday, December 15, 2002 4:47 PM
To: Struts Users Mailing List
Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?

<%
   SessionUtility su = new SessionUtility();
   ArrayList messages =
     (ArrayList)su.getAttribute(session, HomeConstants.MESSAGE_ARRAY);
   pageContext.setAttribute("messages", messages);
%>

<logic:iterate id="myMessage" name="messages">

Mark Conlin wrote:
> I am afraid that still does not work.
> 
> None of these work....
> <logic:iterate id="myMessage" collection="<%=messages%>">
> <logic:iterate id="myMessage" collection=<%=messages%>>
> <logic:iterate id="myMessage" collection="messages">
> 
> 
> -----Original Message-----
> From: Rick Reumann [mailto:maillist@reumann.net] 
> Sent: Sunday, December 15, 2002 7:22 PM
> To: Struts Users Mailing List
> Cc: meconlin@yahoo.com
> Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
> 
> On Sun, 15 Dec 2002 15:39:23 -0500
> "Mark Conlin" <me...@yahoo.com> wrote:
>               
> 
>><%= messages.size() %>
>>            
>><logic:iterate id="myMessage" collection="<%=messages%>">
>><%= myMessage.getSubject() %>
>></logic:iterate>
> 
> 
> Try collection="messages" (without the scriplets).
>  
> 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Kris Schneider <kr...@dotech.com>.
<%
   SessionUtility su = new SessionUtility();
   ArrayList messages =
     (ArrayList)su.getAttribute(session, HomeConstants.MESSAGE_ARRAY);
   pageContext.setAttribute("messages", messages);
%>

<logic:iterate id="myMessage" name="messages">

Mark Conlin wrote:
> I am afraid that still does not work.
> 
> None of these work....
> <logic:iterate id="myMessage" collection="<%=messages%>">
> <logic:iterate id="myMessage" collection=<%=messages%>>
> <logic:iterate id="myMessage" collection="messages">
> 
> 
> -----Original Message-----
> From: Rick Reumann [mailto:maillist@reumann.net] 
> Sent: Sunday, December 15, 2002 7:22 PM
> To: Struts Users Mailing List
> Cc: meconlin@yahoo.com
> Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?
> 
> On Sun, 15 Dec 2002 15:39:23 -0500
> "Mark Conlin" <me...@yahoo.com> wrote:
>               
> 
>><%= messages.size() %>
>>            
>><logic:iterate id="myMessage" collection="<%=messages%>">
>><%= myMessage.getSubject() %>
>></logic:iterate>
> 
> 
> Try collection="messages" (without the scriplets).
>  
> 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Mark Conlin <me...@yahoo.com>.
I am afraid that still does not work.

None of these work....
<logic:iterate id="myMessage" collection="<%=messages%>">
<logic:iterate id="myMessage" collection=<%=messages%>>
<logic:iterate id="myMessage" collection="messages">


-----Original Message-----
From: Rick Reumann [mailto:maillist@reumann.net] 
Sent: Sunday, December 15, 2002 7:22 PM
To: Struts Users Mailing List
Cc: meconlin@yahoo.com
Subject: Re: Iterate tag Tomcat 4.1.12, issue or no?

On Sun, 15 Dec 2002 15:39:23 -0500
"Mark Conlin" <me...@yahoo.com> wrote:
              
> <%= messages.size() %>
>             
> <logic:iterate id="myMessage" collection="<%=messages%>">
> <%= myMessage.getSubject() %>
> </logic:iterate>

Try collection="messages" (without the scriplets).
 

-- 
Rick

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Iterate tag Tomcat 4.1.12, issue or no?

Posted by Rick Reumann <ma...@reumann.net>.
On Sun, 15 Dec 2002 15:39:23 -0500
"Mark Conlin" <me...@yahoo.com> wrote:
              
> <%= messages.size() %>
>             
> <logic:iterate id="myMessage" collection="<%=messages%>">
> <%= myMessage.getSubject() %>
> </logic:iterate>

Try collection="messages" (without the scriplets).
 

-- 
Rick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>