You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Geoffrey Van Nuffelen <ge...@cora.be> on 2001/06/01 11:53:59 UTC
Tag Iterate !!!
Hi all,
I try to use the tag iterate (logic) but I can't. I haven't success.
I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
I try to pass an array of object ( a personnal client class). but when a try
to access a property I have this error :
javax.servlet.ServletException: Cannot find bean client in scope null
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
at
_0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fClientList_0002
ejspClientList_jsp_55.java:214)
What I have to ?? I have to specify a scope ???
Here you are the code of the .jsp , java class wich put the parameter and
client.class.
.jsp :
----------------------------------------
...
<body bgcolor="white">
<logic:iterate id="client" name="test" >
<bean:write name="client" property="pmclient"/>
</logic:iterate>
</body>
...
Java class :
----------------------------------------------------------
Client test[] = clients.getClients();
servlet.log("nmclient from clients : " + test[i].getNmclient(), 1); // test
... it's working
HttpSession session = request.getSession();
session.setAttribute("test", test);
return (mapping.findForward("success"));
Client class :
----------------------------------------
public class Client {
private String nmclient = "";
private String pmclient = "";
private long cdclient;
public Client() {
}
public String getNmclient() {
return nmclient;
}
public void setNmclient(String newNmclient) {
nmclient = newNmclient;
}
public String getPmclient() {
return pmclient;
}
public void setPmclient(String newPmclient) {
pmclient = newPmclient;
}
public long getCdclient() {
return cdclient;
}
public void setCdclient(long newCdclient) {
cdclient = newCdclient;
}
}
Thanks in advance for your help.
Geoffrey...
Re: Tag Iterate !!!
Posted by Luis Olivares <ol...@infosphere.com>.
In fact, the Iterate Tag doesn't put such bean in any scope.
I have tried to use the Equals/NotEquals Tag inside an Iteration Tag and I
simply cannot look inside the property of my 'Iterated Bean' to do the
comparision.
I ended inserting a scriptlet and 'manually' defining the bean resulted from
the Iteration, something like this:
<%
String lastDepartment = "";
%>
<logic:iterate id="document" name="documents" scope="request" >
<bean:define id="department" name="document"
property="department" toScope="request" />
<logic:notEqual name="department" scope="request"
value="<%=lastDepartment%>">
Here I print a Title (DepartmentName) when the next
Iteration comes with a Different Department
<%
lastDepartment = department.toString();
%>
</logic:notEqual>
<br>
<bean:write name="document" property="title"
filter="true"/>: <bean:write name="document" property="description"
filter="true"/>:
</logic:iterate>
So I think each Iteration you get its in managed in Memory, not in any
scope.
Am I wrong? Is this the correct behavior of the Iterate Tag? Will this be
fixed?.
Regards.
----- Original Message -----
From: "Ali Ozoren" <oz...@home.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, August 30, 2001 2:54 PM
Subject: RE: Tag Iterate !!!
> I have the same problem. It doesn't look like the iterate tag creates the
> bean declared with the id attribute.
> --a
>
> -----Original Message-----
> From: Deadman, Hal [mailto:hal.deadman@tallan.com]
> Sent: Friday, June 01, 2001 1:28 PM
> To: struts-user@jakarta.apache.org
> Subject: RE: Tag Iterate !!!
>
>
> Based on what you are showing in your email, everything looks OK. I don't
> think the problem is with the iterate tag. The message
> "javax.servlet.ServletException: Cannot find bean client in scope null"
> would have to be coming from bean:write which is looking for a bean called
> client. It's looking in all scopes (null just means you didn't specify a
> scope), so you don't need to add a scope. The iterate tag should put a
bean
> in the page scope with the name client.
>
> Are you sure that it is the bean:write tag inside the iterate tag that is
> causing the error or is there something else on the JSP that you aren't
> showing? Try removing the bean:write from the iterate tag and replacing it
> with some html.
>
> > -----Original Message-----
> > From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> > Sent: Friday, June 01, 2001 9:49 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Re: Tag Iterate !!!
> >
> >
> > Hi Ash,
> >
> > Thanks for your help... But I have the same error with Client.
> >
> > Have you got a example of this tag method ???
> >
> > Geoffrey...
> > ----- Original Message -----
> > From: "A.Sharma" <a....@nihilent.com>
> > To: <st...@jakarta.apache.org>
> > Sent: Friday, June 01, 2001 12:10 PM
> > Subject: RE: Tag Iterate !!!
> >
> >
> > >
> > > hi
> > > probably change the case of 'c' in client.
> > > the class has Capiltal 'c' while in JSP you are accessing small 'c'.
> > >
> > > :)
> > > ash
> > >
> > > -----Original Message-----
> > > From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> > > Sent: Friday, June 01, 2001 3:24 PM
> > > To: Struts-User (E-Mail)
> > > Subject: Tag Iterate !!!
> > >
> > >
> > > Hi all,
> > >
> > > I try to use the tag iterate (logic) but I can't. I haven't success.
> > >
> > > I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
> > >
> > > I try to pass an array of object ( a personnal client
> > class). but when a
> > try
> > > to access a property I have this error :
> > >
> > > javax.servlet.ServletException: Cannot find bean client in
> > scope null
> > > at
> > >
> > org.apache.jasper.runtime.PageContextImpl.handlePageException(
> > PageContextImp
> > > l.java:459)
> > > at
> > >
> > _0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fC
> > lientList_0002
> > > ejspClientList_jsp_55.java:214)
> > >
> > > What I have to ?? I have to specify a scope ???
> > >
> > > Here you are the code of the .jsp , java class wich put the
> > parameter and
> > > client.class.
> > >
> > > .jsp :
> > > ----------------------------------------
> > >
> > > ...
> > > <body bgcolor="white">
> > >
> > > <logic:iterate id="client" name="test" >
> > > <bean:write name="client" property="pmclient"/>
> > > </logic:iterate>
> > >
> > > </body>
> > > ...
> > >
> > > Java class :
> > > ----------------------------------------------------------
> > >
> > > Client test[] = clients.getClients();
> > > servlet.log("nmclient from clients : " +
> > test[i].getNmclient(), 1); //
> > test
> > > ... it's working
> > >
> > > HttpSession session = request.getSession();
> > > session.setAttribute("test", test);
> > >
> > > return (mapping.findForward("success"));
> > >
> > >
> > > Client class :
> > > ----------------------------------------
> > >
> > > public class Client {
> > > private String nmclient = "";
> > > private String pmclient = "";
> > > private long cdclient;
> > >
> > > public Client() {
> > > }
> > > public String getNmclient() {
> > > return nmclient;
> > > }
> > > public void setNmclient(String newNmclient) {
> > > nmclient = newNmclient;
> > > }
> > > public String getPmclient() {
> > > return pmclient;
> > > }
> > > public void setPmclient(String newPmclient) {
> > > pmclient = newPmclient;
> > > }
> > > public long getCdclient() {
> > > return cdclient;
> > > }
> > > public void setCdclient(long newCdclient) {
> > > cdclient = newCdclient;
> > > }
> > > }
> > >
> > >
> > > Thanks in advance for your help.
> > >
> > > Geoffrey...
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
RE: Tag Iterate !!!
Posted by Ali Ozoren <oz...@home.com>.
I have the same problem. It doesn't look like the iterate tag creates the
bean declared with the id attribute.
--a
-----Original Message-----
From: Deadman, Hal [mailto:hal.deadman@tallan.com]
Sent: Friday, June 01, 2001 1:28 PM
To: struts-user@jakarta.apache.org
Subject: RE: Tag Iterate !!!
Based on what you are showing in your email, everything looks OK. I don't
think the problem is with the iterate tag. The message
"javax.servlet.ServletException: Cannot find bean client in scope null"
would have to be coming from bean:write which is looking for a bean called
client. It's looking in all scopes (null just means you didn't specify a
scope), so you don't need to add a scope. The iterate tag should put a bean
in the page scope with the name client.
Are you sure that it is the bean:write tag inside the iterate tag that is
causing the error or is there something else on the JSP that you aren't
showing? Try removing the bean:write from the iterate tag and replacing it
with some html.
> -----Original Message-----
> From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> Sent: Friday, June 01, 2001 9:49 AM
> To: struts-user@jakarta.apache.org
> Subject: Re: Tag Iterate !!!
>
>
> Hi Ash,
>
> Thanks for your help... But I have the same error with Client.
>
> Have you got a example of this tag method ???
>
> Geoffrey...
> ----- Original Message -----
> From: "A.Sharma" <a....@nihilent.com>
> To: <st...@jakarta.apache.org>
> Sent: Friday, June 01, 2001 12:10 PM
> Subject: RE: Tag Iterate !!!
>
>
> >
> > hi
> > probably change the case of 'c' in client.
> > the class has Capiltal 'c' while in JSP you are accessing small 'c'.
> >
> > :)
> > ash
> >
> > -----Original Message-----
> > From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> > Sent: Friday, June 01, 2001 3:24 PM
> > To: Struts-User (E-Mail)
> > Subject: Tag Iterate !!!
> >
> >
> > Hi all,
> >
> > I try to use the tag iterate (logic) but I can't. I haven't success.
> >
> > I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
> >
> > I try to pass an array of object ( a personnal client
> class). but when a
> try
> > to access a property I have this error :
> >
> > javax.servlet.ServletException: Cannot find bean client in
> scope null
> > at
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImp
> > l.java:459)
> > at
> >
> _0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fC
> lientList_0002
> > ejspClientList_jsp_55.java:214)
> >
> > What I have to ?? I have to specify a scope ???
> >
> > Here you are the code of the .jsp , java class wich put the
> parameter and
> > client.class.
> >
> > .jsp :
> > ----------------------------------------
> >
> > ...
> > <body bgcolor="white">
> >
> > <logic:iterate id="client" name="test" >
> > <bean:write name="client" property="pmclient"/>
> > </logic:iterate>
> >
> > </body>
> > ...
> >
> > Java class :
> > ----------------------------------------------------------
> >
> > Client test[] = clients.getClients();
> > servlet.log("nmclient from clients : " +
> test[i].getNmclient(), 1); //
> test
> > ... it's working
> >
> > HttpSession session = request.getSession();
> > session.setAttribute("test", test);
> >
> > return (mapping.findForward("success"));
> >
> >
> > Client class :
> > ----------------------------------------
> >
> > public class Client {
> > private String nmclient = "";
> > private String pmclient = "";
> > private long cdclient;
> >
> > public Client() {
> > }
> > public String getNmclient() {
> > return nmclient;
> > }
> > public void setNmclient(String newNmclient) {
> > nmclient = newNmclient;
> > }
> > public String getPmclient() {
> > return pmclient;
> > }
> > public void setPmclient(String newPmclient) {
> > pmclient = newPmclient;
> > }
> > public long getCdclient() {
> > return cdclient;
> > }
> > public void setCdclient(long newCdclient) {
> > cdclient = newCdclient;
> > }
> > }
> >
> >
> > Thanks in advance for your help.
> >
> > Geoffrey...
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
RE: Tag Iterate !!!
Posted by "Deadman, Hal" <ha...@tallan.com>.
Based on what you are showing in your email, everything looks OK. I don't
think the problem is with the iterate tag. The message
"javax.servlet.ServletException: Cannot find bean client in scope null"
would have to be coming from bean:write which is looking for a bean called
client. It's looking in all scopes (null just means you didn't specify a
scope), so you don't need to add a scope. The iterate tag should put a bean
in the page scope with the name client.
Are you sure that it is the bean:write tag inside the iterate tag that is
causing the error or is there something else on the JSP that you aren't
showing? Try removing the bean:write from the iterate tag and replacing it
with some html.
> -----Original Message-----
> From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> Sent: Friday, June 01, 2001 9:49 AM
> To: struts-user@jakarta.apache.org
> Subject: Re: Tag Iterate !!!
>
>
> Hi Ash,
>
> Thanks for your help... But I have the same error with Client.
>
> Have you got a example of this tag method ???
>
> Geoffrey...
> ----- Original Message -----
> From: "A.Sharma" <a....@nihilent.com>
> To: <st...@jakarta.apache.org>
> Sent: Friday, June 01, 2001 12:10 PM
> Subject: RE: Tag Iterate !!!
>
>
> >
> > hi
> > probably change the case of 'c' in client.
> > the class has Capiltal 'c' while in JSP you are accessing small 'c'.
> >
> > :)
> > ash
> >
> > -----Original Message-----
> > From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> > Sent: Friday, June 01, 2001 3:24 PM
> > To: Struts-User (E-Mail)
> > Subject: Tag Iterate !!!
> >
> >
> > Hi all,
> >
> > I try to use the tag iterate (logic) but I can't. I haven't success.
> >
> > I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
> >
> > I try to pass an array of object ( a personnal client
> class). but when a
> try
> > to access a property I have this error :
> >
> > javax.servlet.ServletException: Cannot find bean client in
> scope null
> > at
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImp
> > l.java:459)
> > at
> >
> _0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fC
> lientList_0002
> > ejspClientList_jsp_55.java:214)
> >
> > What I have to ?? I have to specify a scope ???
> >
> > Here you are the code of the .jsp , java class wich put the
> parameter and
> > client.class.
> >
> > .jsp :
> > ----------------------------------------
> >
> > ...
> > <body bgcolor="white">
> >
> > <logic:iterate id="client" name="test" >
> > <bean:write name="client" property="pmclient"/>
> > </logic:iterate>
> >
> > </body>
> > ...
> >
> > Java class :
> > ----------------------------------------------------------
> >
> > Client test[] = clients.getClients();
> > servlet.log("nmclient from clients : " +
> test[i].getNmclient(), 1); //
> test
> > ... it's working
> >
> > HttpSession session = request.getSession();
> > session.setAttribute("test", test);
> >
> > return (mapping.findForward("success"));
> >
> >
> > Client class :
> > ----------------------------------------
> >
> > public class Client {
> > private String nmclient = "";
> > private String pmclient = "";
> > private long cdclient;
> >
> > public Client() {
> > }
> > public String getNmclient() {
> > return nmclient;
> > }
> > public void setNmclient(String newNmclient) {
> > nmclient = newNmclient;
> > }
> > public String getPmclient() {
> > return pmclient;
> > }
> > public void setPmclient(String newPmclient) {
> > pmclient = newPmclient;
> > }
> > public long getCdclient() {
> > return cdclient;
> > }
> > public void setCdclient(long newCdclient) {
> > cdclient = newCdclient;
> > }
> > }
> >
> >
> > Thanks in advance for your help.
> >
> > Geoffrey...
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
Re: Tag Iterate !!!
Posted by Geoffrey Van Nuffelen <ge...@cora.be>.
Hi Ash,
Thanks for your help... But I have the same error with Client.
Have you got a example of this tag method ???
Geoffrey...
----- Original Message -----
From: "A.Sharma" <a....@nihilent.com>
To: <st...@jakarta.apache.org>
Sent: Friday, June 01, 2001 12:10 PM
Subject: RE: Tag Iterate !!!
>
> hi
> probably change the case of 'c' in client.
> the class has Capiltal 'c' while in JSP you are accessing small 'c'.
>
> :)
> ash
>
> -----Original Message-----
> From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
> Sent: Friday, June 01, 2001 3:24 PM
> To: Struts-User (E-Mail)
> Subject: Tag Iterate !!!
>
>
> Hi all,
>
> I try to use the tag iterate (logic) but I can't. I haven't success.
>
> I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
>
> I try to pass an array of object ( a personnal client class). but when a
try
> to access a property I have this error :
>
> javax.servlet.ServletException: Cannot find bean client in scope null
> at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:459)
> at
>
_0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fClientList_0002
> ejspClientList_jsp_55.java:214)
>
> What I have to ?? I have to specify a scope ???
>
> Here you are the code of the .jsp , java class wich put the parameter and
> client.class.
>
> .jsp :
> ----------------------------------------
>
> ...
> <body bgcolor="white">
>
> <logic:iterate id="client" name="test" >
> <bean:write name="client" property="pmclient"/>
> </logic:iterate>
>
> </body>
> ...
>
> Java class :
> ----------------------------------------------------------
>
> Client test[] = clients.getClients();
> servlet.log("nmclient from clients : " + test[i].getNmclient(), 1); //
test
> ... it's working
>
> HttpSession session = request.getSession();
> session.setAttribute("test", test);
>
> return (mapping.findForward("success"));
>
>
> Client class :
> ----------------------------------------
>
> public class Client {
> private String nmclient = "";
> private String pmclient = "";
> private long cdclient;
>
> public Client() {
> }
> public String getNmclient() {
> return nmclient;
> }
> public void setNmclient(String newNmclient) {
> nmclient = newNmclient;
> }
> public String getPmclient() {
> return pmclient;
> }
> public void setPmclient(String newPmclient) {
> pmclient = newPmclient;
> }
> public long getCdclient() {
> return cdclient;
> }
> public void setCdclient(long newCdclient) {
> cdclient = newCdclient;
> }
> }
>
>
> Thanks in advance for your help.
>
> Geoffrey...
>
>
>
>
>
>
>
>
>
RE: Tag Iterate !!!
Posted by "A.Sharma" <a....@nihilent.com>.
hi
probably change the case of 'c' in client.
the class has Capiltal 'c' while in JSP you are accessing small 'c'.
:)
ash
-----Original Message-----
From: Geoffrey Van Nuffelen [mailto:geoffrey.vannuffelen@cora.be]
Sent: Friday, June 01, 2001 3:24 PM
To: Struts-User (E-Mail)
Subject: Tag Iterate !!!
Hi all,
I try to use the tag iterate (logic) but I can't. I haven't success.
I am working on Windows NT with tomcat 3.2 and struts 1.0b-2.
I try to pass an array of object ( a personnal client class). but when a try
to access a property I have this error :
javax.servlet.ServletException: Cannot find bean client in scope null
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
at
_0002fClientList_0002ejspClientList_jsp_55._jspService(_0002fClientList_0002
ejspClientList_jsp_55.java:214)
What I have to ?? I have to specify a scope ???
Here you are the code of the .jsp , java class wich put the parameter and
client.class.
.jsp :
----------------------------------------
...
<body bgcolor="white">
<logic:iterate id="client" name="test" >
<bean:write name="client" property="pmclient"/>
</logic:iterate>
</body>
...
Java class :
----------------------------------------------------------
Client test[] = clients.getClients();
servlet.log("nmclient from clients : " + test[i].getNmclient(), 1); // test
... it's working
HttpSession session = request.getSession();
session.setAttribute("test", test);
return (mapping.findForward("success"));
Client class :
----------------------------------------
public class Client {
private String nmclient = "";
private String pmclient = "";
private long cdclient;
public Client() {
}
public String getNmclient() {
return nmclient;
}
public void setNmclient(String newNmclient) {
nmclient = newNmclient;
}
public String getPmclient() {
return pmclient;
}
public void setPmclient(String newPmclient) {
pmclient = newPmclient;
}
public long getCdclient() {
return cdclient;
}
public void setCdclient(long newCdclient) {
cdclient = newCdclient;
}
}
Thanks in advance for your help.
Geoffrey...