You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Lee <ml...@hotmail.com> on 2002/09/10 16:40:39 UTC

Re: How to user logic:iterate[MORON]

I would like to thank everyone on this email list that helped out. Every
little bit helped including the property attribute on iterate and that
logic:present is very handy.
The main problem though was a complete brain fart on my part.
I am moron, hear me roar.
I forgot to include the tag lib import for logic. The thing I dont
understand is how it even go to the bean:write tag inside the iterate and
failed there?
Oh well, if you ever get an error message like I did, don't run around like
a chickend with your head chopped off, just include this line at the top of
the jsp...
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

AAAAAAAAAAA, I hate stupid mistakes that waste everyone's time!!!
Mike
:(


----- Original Message -----
From: "John Yu" <jo...@scioworks.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 09, 2002 10:20 PM
Subject: Re: How to user logic:iterate


> Option 1:
>
> In Action,
>
>    request.setAttribute("myUsers", users); // no need to call getUsers()
>
> In JSP,
>
>    <logic:present name="myUsers">
>      <logic:iterate id="aUser" name="myUsers" property="users"
>                     scope="request">
>      <tr>
>        <td><bean:write name="aUser" property="userID"/></td>
>        <td><bean:write name="aUser" property="userType"/></td>
>        <td><bean:write name="aUser" property="fName"/></td>
>        <td><bean:write name="aUser" property="mName"/></td>
>        <td><bean:write name="aUser" property="lName"/></td>
>        <td><bean:write name="aUser" property="accoundDisabled"/></td>
>        <td><bean:write name="aUser" property="email"/></td>
>      </tr>
>      </logic:iterate>
>    </logic:present>
>
> Option 2:
>
> Use your existing code, but get rid of the "user." part from the property
> of the <bean:write> tags.
>
> At 04:55 am 10-09-2002, you wrote:
> >Im having a helluva time getting logic:iterate to work..
> >I have a Users object that contains an array list of
> >User objects.
> >you call Users.getUsers() and it returns an arrayList
> >I stick that in the request object in the perform() method using
> >request.setAttribute("users", users.getUsers());
> >In the JSP the code I have is;
> >
> >  <% ArrayList users = (ArrayList) request.getAttribute("users");
> >        if(users != null)
> >        {%>
> >     <logic:iterate name="users" id="aUser" scope="request">
> >     <tr>
> >       <td><bean:write name="aUser" property="user.userID"/></td>
> >       <td><bean:write name="aUser" property="user.userType"/></td>
> >       <td><bean:write name="aUser" property="user.fName"/></td>
> >       <td><bean:write name="aUser" property="user.mName"/></td>
> >       <td><bean:write name="aUser" property="user.lName"/></td>
> >       <td><bean:write name="aUser"
property="user.accoundDisabled"/></td>
> >       <td><bean:write name="aUser" property="user.email"/></td>
> >     </tr>
> >     </logic:iterate>
> >         <%}%>
> >
> >The error I'm getting is;
> >
> ><Sep 9, 2002 4:52:00 PM EDT> <Error> <HTTP>
> ><[WebAppServletContext(4398493,recei
> >ptsplus,/receiptsplus)] Root cause of ServletException
> >javax.servlet.jsp.JspException: Cannot find bean aUser in scope null
> >         at
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:493)
> >         at
> > org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
> >         at
> > jsp_servlet.__advanced_user_search._jspService(__advanced_user_search
> >.java:1541)
> >         at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> >         at
> > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> >pl.java:265)
> >
> >what am I doing wrong?
> >help!
> >thanks,
> >Mike
>
> --
> John Yu                       Scioworks Technologies
> e: john@scioworks.com         w: +(65) 873 5989
> w: http://www.scioworks.com   m: +(65) 9782 9610
>
> Scioworks Camino - "Don't develop Struts Apps without it!"
> Copyright (c) 2002 John Yu/Scioworks Technologies. All rights reserved.
>
>
> --
> 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: How to user logic:iterate[MORON]

Posted by Ted Husted <hu...@apache.org>.
Without the taglib statement, the tag is completely ignored, as if it 
wasn't there. The JSP service assumes it's a HTML tag, and the browsers 
silently swallow anything they don't understand. C'est la vive.

-T.

Michael Lee wrote:

> I would like to thank everyone on this email list that helped out. Every
> little bit helped including the property attribute on iterate and that
> logic:present is very handy.
> The main problem though was a complete brain fart on my part.
> I am moron, hear me roar.
> I forgot to include the tag lib import for logic. The thing I dont
> understand is how it even go to the bean:write tag inside the iterate and
> failed there?
> Oh well, if you ever get an error message like I did, don't run around like
> a chickend with your head chopped off, just include this line at the top of
> the jsp...
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> 
> AAAAAAAAAAA, I hate stupid mistakes that waste everyone's time!!!
> Mike
> :(
> 
> 
> ----- Original Message -----
> From: "John Yu" <jo...@scioworks.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, September 09, 2002 10:20 PM
> Subject: Re: How to user logic:iterate
> 
> 
> 
>>Option 1:
>>
>>In Action,
>>
>>   request.setAttribute("myUsers", users); // no need to call getUsers()
>>
>>In JSP,
>>
>>   <logic:present name="myUsers">
>>     <logic:iterate id="aUser" name="myUsers" property="users"
>>                    scope="request">
>>     <tr>
>>       <td><bean:write name="aUser" property="userID"/></td>
>>       <td><bean:write name="aUser" property="userType"/></td>
>>       <td><bean:write name="aUser" property="fName"/></td>
>>       <td><bean:write name="aUser" property="mName"/></td>
>>       <td><bean:write name="aUser" property="lName"/></td>
>>       <td><bean:write name="aUser" property="accoundDisabled"/></td>
>>       <td><bean:write name="aUser" property="email"/></td>
>>     </tr>
>>     </logic:iterate>
>>   </logic:present>
>>
>>Option 2:
>>
>>Use your existing code, but get rid of the "user." part from the property
>>of the <bean:write> tags.
>>
>>At 04:55 am 10-09-2002, you wrote:
>>
>>>Im having a helluva time getting logic:iterate to work..
>>>I have a Users object that contains an array list of
>>>User objects.
>>>you call Users.getUsers() and it returns an arrayList
>>>I stick that in the request object in the perform() method using
>>>request.setAttribute("users", users.getUsers());
>>>In the JSP the code I have is;
>>>
>>> <% ArrayList users = (ArrayList) request.getAttribute("users");
>>>       if(users != null)
>>>       {%>
>>>    <logic:iterate name="users" id="aUser" scope="request">
>>>    <tr>
>>>      <td><bean:write name="aUser" property="user.userID"/></td>
>>>      <td><bean:write name="aUser" property="user.userType"/></td>
>>>      <td><bean:write name="aUser" property="user.fName"/></td>
>>>      <td><bean:write name="aUser" property="user.mName"/></td>
>>>      <td><bean:write name="aUser" property="user.lName"/></td>
>>>      <td><bean:write name="aUser"
>>>
> property="user.accoundDisabled"/></td>
> 
>>>      <td><bean:write name="aUser" property="user.email"/></td>
>>>    </tr>
>>>    </logic:iterate>
>>>        <%}%>
>>>
>>>The error I'm getting is;
>>>
>>><Sep 9, 2002 4:52:00 PM EDT> <Error> <HTTP>
>>><[WebAppServletContext(4398493,recei
>>>ptsplus,/receiptsplus)] Root cause of ServletException
>>>javax.servlet.jsp.JspException: Cannot find bean aUser in scope null
>>>        at
>>>
> org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:493)
> 
>>>        at
>>>org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
>>>        at
>>>jsp_servlet.__advanced_user_search._jspService(__advanced_user_search
>>>.java:1541)
>>>        at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>>>        at
>>>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
>>>pl.java:265)
>>>
>>>what am I doing wrong?
>>>help!
>>>thanks,
>>>Mike
>>>
>>--
>>John Yu                       Scioworks Technologies
>>e: john@scioworks.com         w: +(65) 873 5989
>>w: http://www.scioworks.com   m: +(65) 9782 9610
>>
>>Scioworks Camino - "Don't develop Struts Apps without it!"
>>Copyright (c) 2002 John Yu/Scioworks Technologies. All rights reserved.
>>
>>
>>--
>>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>
> 
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-author, Java Web Development with Struts
Order it today:
<http://husted.com/struts/book.html>


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