You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by javayes <ja...@yahoo.com> on 2001/01/10 17:10:18 UTC
iterate tag problem
Hi all,
I am trying to use the logic:iterate tag to display a resultset stored
in an ArrayList but I get the following error:
javax.servlet.ServletException: No bean found for attribute key row
The collection is stored in the request and is named widgets
The code is:
<logic:iterate name="widgets" id="row">
<tr>
<td align="left">
<bean:write name="row" property="widgetid" filter="true"/>
</td>
<td align="left">
<bean:write name="row" property="field1" filter="true"/>
</td>
<td align="center">
<bean:write name="row" property="field2" filter="true"/>
</td>
</tr>
</logic:iterate>
To confirm that the collection is there, I added the following and it
works:
<%
List list = null;
list = (List)request.getAttribute("widgets");
Iterator iterator = list.iterator();
while(iterator.hasNext()) {
Widget wid = (Widget) iterator.next();
out.println(wid.getField1());
}
%>
It seems like the iterate tag does not expose a row bean for each loop.
Can anybody tell me where I went wrong?
Thanks.
This is the stack print of the error.
javax.servlet.ServletException: No bean found for attribute key row
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
at
_0002flistWidget_0002ejsplistWidget_jsp_33._jspService(_0002flistWidget_0002ejsplistWidget_jsp_33.java:339)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1592)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1435)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:464)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Infinite Loop
Posted by swapnil ghiware <sw...@india.hp.com>.
Hello,
I am using Struts 0.5 version (modified to that it can handle default action
mappings) and am using Caucho Resin 1.2.1 as the web server.
I have defined my Action Servlet Mapping as :
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/cpf/*</url-pattern>
</servlet-mapping>
and my Action Mapping configuration file contains :
<action-mappings>
<!-- Default User Action-->
<action path="/defaultPath"
actionClass="com.hp.cpf.beans.UserRegistrationAction"
formAttribute="defaultActionForm"
unknown="true"
formClass="com.hp.cpf.beans.UserRegistrationForm">
<forward name="success" path="/cpf/jsps/MainController.jsp"/>
</action>
</action-mappings>
When I send a HTTP request, the ActionServlet forwards that to
"/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the
forwarded URL starts with "cpf", it is again
redirected to the ActionServlet which in turn forwards it to the
"/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too
Many Servlets" exception.
Any pointers on how to work around this problem.
Thanks in advance,
Swapnil.
Re: Infinite Loop
Posted by swapnil ghiware <sw...@india.hp.com>.
That's a possibility. But there is a bunch of code and existing directory
structure which i would rather not modify unless I have no other option.
Thanks,
Swapnil.
----- Original Message -----
From: Craig R. McClanahan <Cr...@eng.sun.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, January 10, 2001 12:50 PM
Subject: Re: Infinite Loop
> swapnil ghiware wrote:
>
> > Hello,
> > I am using Struts 0.5 version (modified to that it can handle default
action
> > mappings) and am using Caucho Resin 1.2.1 as the web server.
> >
> > I have defined my Action Servlet Mapping as :
> >
> > <!-- Action Servlet Mapping -->
> > <servlet-mapping>
> > <servlet-name>action</servlet-name>
> > <url-pattern>/cpf/*</url-pattern>
> > </servlet-mapping>
> >
> > and my Action Mapping configuration file contains :
> >
> > <action-mappings>
> >
> > <!-- Default User Action-->
> > <action path="/defaultPath"
> > actionClass="com.hp.cpf.beans.UserRegistrationAction"
> > formAttribute="defaultActionForm"
> > unknown="true"
> > formClass="com.hp.cpf.beans.UserRegistrationForm">
> > <forward name="success" path="/cpf/jsps/MainController.jsp"/>
> > </action>
> >
> > </action-mappings>
> >
> > When I send a HTTP request, the ActionServlet forwards that to
> > "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since,
the
> > forwarded URL starts with "cpf", it is again
> > redirected to the ActionServlet which in turn forwards it to the
> > "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too
> > Many Servlets" exception.
> >
> > Any pointers on how to work around this problem.
> >
>
> Can't you make sure that your JSP page paths do not start with "/cpf"? In
other
> words, you might arrange your web app files like this:
>
> WEB-INF/
> web.xml
> struts-config.xml
> jsps/
> ... *.jsp files ...
>
> and the path entry would be "/jsps/MainController.jsp" instead of
> "/cpf/jsps/MainController.jsp".
>
> >
> > Thanks in advance,
> > Swapnil.
>
> Craig McClanahan
>
>
>
Re: Infinite Loop
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
swapnil ghiware wrote:
> Hello,
> I am using Struts 0.5 version (modified to that it can handle default action
> mappings) and am using Caucho Resin 1.2.1 as the web server.
>
> I have defined my Action Servlet Mapping as :
>
> <!-- Action Servlet Mapping -->
> <servlet-mapping>
> <servlet-name>action</servlet-name>
> <url-pattern>/cpf/*</url-pattern>
> </servlet-mapping>
>
> and my Action Mapping configuration file contains :
>
> <action-mappings>
>
> <!-- Default User Action-->
> <action path="/defaultPath"
> actionClass="com.hp.cpf.beans.UserRegistrationAction"
> formAttribute="defaultActionForm"
> unknown="true"
> formClass="com.hp.cpf.beans.UserRegistrationForm">
> <forward name="success" path="/cpf/jsps/MainController.jsp"/>
> </action>
>
> </action-mappings>
>
> When I send a HTTP request, the ActionServlet forwards that to
> "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the
> forwarded URL starts with "cpf", it is again
> redirected to the ActionServlet which in turn forwards it to the
> "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too
> Many Servlets" exception.
>
> Any pointers on how to work around this problem.
>
Can't you make sure that your JSP page paths do not start with "/cpf"? In other
words, you might arrange your web app files like this:
WEB-INF/
web.xml
struts-config.xml
jsps/
... *.jsp files ...
and the path entry would be "/jsps/MainController.jsp" instead of
"/cpf/jsps/MainController.jsp".
>
> Thanks in advance,
> Swapnil.
Craig McClanahan
Re: iterate tag problem
Posted by javayes <ja...@yahoo.com>.
Problem solved. It was missing the logic tld.
Thanks a lot.
(BTW, I was using 2001/01/08 nightly build)
Ted Husted wrote:
> The first two things are:
>
> 1 - Double check that the logic TLD is being imported properly. If it's
> left out, you will get this error (rather than something sensible, like
> logic tag not found!)
>
> 2 - Try it against the current build (if you haven't). Iterate was
> broken in a build a while back.
>
> *********** REPLY SEPARATOR ***********
>
> On 1/10/2001 at 11:10 AM javayes wrote:
>
> Hi all,
>
> I am trying to use the logic:iterate tag to display a resultset stored
> in an ArrayList but I get the following error:
> javax.servlet.ServletException: No bean found for attribute key row
>
> The collection is stored in the request and is named widgets
>
> The code is:
> <logic:iterate name="widgets" id="row">
> <tr>
> <td align="left">
> <bean:write name="row" property="widgetid" filter="true"/>
> </td>
> <td align="left">
> <bean:write name="row" property="field1" filter="true"/>
> </td>
> <td align="center">
> <bean:write name="row" property="field2" filter="true"/>
> </td>
> </tr>
> </logic:iterate>
>
> To confirm that the collection is there, I added the following and it
> works:
> <%
> List list = null;
> list = (List)request.getAttribute("widgets");
> Iterator iterator = list.iterator();
> while(iterator.hasNext()) {
> Widget wid = (Widget) iterator.next();
> out.println(wid.getField1());
> }
> %>
>
> It seems like the iterate tag does not expose a row bean for each loop.
> Can anybody tell me where I went wrong?
> Thanks.
>
> This is the stack print of the error.
> javax.servlet.ServletException: No bean found for attribute key row
> at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
> tImpl.java:459)
>
> at
> _0002flistWidget_0002ejsplistWidget_jsp_33._jspService(_0002flistWidget_
> 0002ejsplistWidget_jsp_33.java:339)
>
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
> t.java:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcher
> Impl.java:194)
>
> at
> org.apache.struts.action.ActionServlet.processActionForward(ActionServle
> t.java:1592)
>
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1435)
> at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:464)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav
> a:797)
>
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H
> ttpConnectionHandler.java:210)
>
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416
> )
>
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:49
> 8)
>
> at java.lang.Thread.run(Thread.java:484)
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Re: iterate tag problem
Posted by Ted Husted <ne...@husted.com>.
The first two things are:
1 - Double check that the logic TLD is being imported properly. If it's
left out, you will get this error (rather than something sensible, like
logic tag not found!)
2 - Try it against the current build (if you haven't). Iterate was
broken in a build a while back.
*********** REPLY SEPARATOR ***********
On 1/10/2001 at 11:10 AM javayes wrote:
Hi all,
I am trying to use the logic:iterate tag to display a resultset stored
in an ArrayList but I get the following error:
javax.servlet.ServletException: No bean found for attribute key row
The collection is stored in the request and is named widgets
The code is:
<logic:iterate name="widgets" id="row">
<tr>
<td align="left">
<bean:write name="row" property="widgetid" filter="true"/>
</td>
<td align="left">
<bean:write name="row" property="field1" filter="true"/>
</td>
<td align="center">
<bean:write name="row" property="field2" filter="true"/>
</td>
</tr>
</logic:iterate>
To confirm that the collection is there, I added the following and it
works:
<%
List list = null;
list = (List)request.getAttribute("widgets");
Iterator iterator = list.iterator();
while(iterator.hasNext()) {
Widget wid = (Widget) iterator.next();
out.println(wid.getField1());
}
%>
It seems like the iterate tag does not expose a row bean for each loop.
Can anybody tell me where I went wrong?
Thanks.
This is the stack print of the error.
javax.servlet.ServletException: No bean found for attribute key row
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:459)
at
_0002flistWidget_0002ejsplistWidget_jsp_33._jspService(_0002flistWidget_
0002ejsplistWidget_jsp_33.java:339)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.java:177)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcher
Impl.java:194)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServle
t.java:1592)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1435)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:464)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav
a:797)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H
ttpConnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416
)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:49
8)
at java.lang.Thread.run(Thread.java:484)
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Re: iterate tag problem
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
javayes wrote:
> Hi all,
>
> I am trying to use the logic:iterate tag to display a resultset stored
> in an ArrayList but I get the following error:
> javax.servlet.ServletException: No bean found for attribute key row
>
This bug existed in 1.0 nightly builds up until last week or so. Have you tried it with a recent nightly
build?
Craig McClanahan