Re: Iterate Problem
This is all kind of fussy. You have to get the id's and everything right, manage the bean names etc, etc, etc. You can forget all of that stuff and use the nested tags. Makes life 100% simpler for iterating and everything else. They've been in Struts since January. Just that not too many people put them forward to help the easy stuff, which they make even easier... Primer, tutorials and downloads... http://www.keyboardmonkey.com/next It sounds like a plug, but I've had no complaints from anyone who's using them. Arron. Rick Reumann wrote: On Friday, April 26, 2002, 2:00:19 PM, Mark wrote: GM I sure seem to be having my share of problems with logic:iterate GM this week GM My form bean (EditCustomerForm) has a property that sets and gets a List of GM Customer objects. These objects themselves contain the usual name, address, GM etc. stuff. I need to iterate through the collection of objects and display GM the individual properties (like name, address, etc.) of each object. The GM Struts bean TagLib documentation and Developer Guide are not particularly GM useful in this regard. We are adhering strictly to the Struts model and do GM not want to use scriplets. GM If anyone has figured this out, please post a solution. Not sure if this is the best way, I'm accomplishing what you are talking about (using Stores instead of customers) by: 1) I have an action class call some business logic that returns my collection of Store beans (In your case I would think you would call the method in the EditCustomerForm that returns to you your collection of Customer objects). The action then puts this collection (in my case ArrayList) into the request (or session). 2) Then in you jsp displaying the info you could do: jsp:useBean id=stores scope=request beanName=stores type=ArrayList/ logic:iterate id=aStore name=stores indexId=storesIndex Unit Number: bean:write name=aStore property=unitID/BR etc /logic:iterate (You might not need the indexId in the iterate tag but I need it for determining the first time through the list for displaying certain headers etc. Thanks to those on the list that just showed me how to do that:) GM Thanks, GM Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Iterate Problem
Hi, Mark: I am displaying task information in an HTML table using the iterate tag. In the table are a set of input fields that allow my user to modfiy the values of each task (in your case you may simply want to display the value as readonly text). By using the indexed = true attribute of the text tag, when you submit the html form struts will update each of the action forms accessible via the getTasks()/setTasks() methods in MyTaskActionForm: struts_logic:iterate name=MyTaskActionForm property=tasks id=task indexId=index tr td valign=top struts_html:text name=tasks property=name indexed=true / /td td valign=top struts_html:text name=tasks property=dueDate size=30 indexed=true / /td td valign=top struts_html:text name=tasks property=description indexed=true / /td /tr /struts_logic:iterate Hope this helps, Chris -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 2:00 PM To: Struts (E-mail) Subject: Iterate Problem I sure seem to be having my share of problems with logic:iterate this week My form bean (EditCustomerForm) has a property that sets and gets a List of Customer objects. These objects themselves contain the usual name, address, etc. stuff. I need to iterate through the collection of objects and display the individual properties (like name, address, etc.) of each object. The Struts bean TagLib documentation and Developer Guide are not particularly useful in this regard. We are adhering strictly to the Struts model and do not want to use scriplets. If anyone has figured this out, please post a solution. Thanks, Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Iterate Problem
On Friday, April 26, 2002, 2:00:19 PM, Mark wrote: GM I sure seem to be having my share of problems with logic:iterate GM this week GM My form bean (EditCustomerForm) has a property that sets and gets a List of GM Customer objects. These objects themselves contain the usual name, address, GM etc. stuff. I need to iterate through the collection of objects and display GM the individual properties (like name, address, etc.) of each object. The GM Struts bean TagLib documentation and Developer Guide are not particularly GM useful in this regard. We are adhering strictly to the Struts model and do GM not want to use scriplets. GM If anyone has figured this out, please post a solution. Not sure if this is the best way, I'm accomplishing what you are talking about (using Stores instead of customers) by: 1) I have an action class call some business logic that returns my collection of Store beans (In your case I would think you would call the method in the EditCustomerForm that returns to you your collection of Customer objects). The action then puts this collection (in my case ArrayList) into the request (or session). 2) Then in you jsp displaying the info you could do: jsp:useBean id=stores scope=request beanName=stores type=ArrayList/ logic:iterate id=aStore name=stores indexId=storesIndex Unit Number: bean:write name=aStore property=unitID/BR etc /logic:iterate (You might not need the indexId in the iterate tag but I need it for determining the first time through the list for displaying certain headers etc. Thanks to those on the list that just showed me how to do that:) GM Thanks, GM Mark -- Rick mailto:[EMAIL PROTECTED] As the light changed from red to green to yellow and back to red again, I sat there thinking about life. Was it nothing more than a bunch of honking and yelling? Sometimes it seemed that way. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Iterate Problem
logic:iterate name=EditCustomerForm property=customers id=customer type=com.whatever.Customer tr tdbean:write name=customer property=name//td tdbean:write name=customer property=address//td /tr /logic:iterate -- Jim Galbreath, Mark [EMAIL PROTECTED] writes: I sure seem to be having my share of problems with logic:iterate this week My form bean (EditCustomerForm) has a property that sets and gets a List of Customer objects. These objects themselves contain the usual name, address, etc. stuff. I need to iterate through the collection of objects and display the individual properties (like name, address, etc.) of each object. The Struts bean TagLib documentation and Developer Guide are not particularly useful in this regard. We are adhering strictly to the Struts model and do not want to use scriplets. If anyone has figured this out, please post a solution. Thanks, Mark -- Jim Crossley http://www.lads.com/~jim -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Iterate problem
what we did here is set up a Vector or something like that which holds the beans (each bean will populate one row in this table). Then set this Vector into your session/request depending on what you like, then in the jsp page, use logic:iterate to create the table rows so the number of table rows will be the same of number of the elements in the Vector you passed on. Thanks, Yanhui -Original Message- From: Sanjay Choudhary [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 7:16 PM To: Struts Users Mailing List Subject: Iterate problem Dear Friends, I have a jsp in where we have columns as follows Add no. of rows you wish to add - go AB CD E save 1. Using java scripts we allow user to add rows dynamically on the page. 2. How may I achieve this functionality of dynamically adding rows using struts? how will it map it back to an collection attribute in java bean. Everybody's comments are highly appreciated. Thanks, Sanjay __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: iterate problem
Oliver == Oliver Kiessler [EMAIL PROTECTED] writes: Oliver hi, Oliver my problem: Oliver i have a bean with two ArrayLists. my action class gets the results from Oliver the database and puts them into the appropriate Arraylist. Then the Oliver whole bean is appended to the session. Oliver so in my view page i would like to iterate thru the ArrayLists of my Oliver bean. BUT i need to generate a hyperlink with something like that: Oliver a href=link.do?name=*in here the value from arraylist1 from the Oliver bean**in here the value from arraylist2 from the bean*/abr Oliver .* next hyperlink* Oliver how do i have to use the logic:iterate tag? Oliver something like that apparently doesn't work Oliver logic:iterate name=bean property=arraylist1 id=a1 Oliver type=java.lang.String Oliver logic:iterate name=bean property=arraylist2 id=a2 Oliver type=java.lang.String Oliver a href=link.do?name=bean:write name=a1 /bean:write Oliver name=a2 //abr Oliver /logic:iterate Oliver /logic:iterate Oliver am i missing something? or do i have to populate my bean differently? Oliver Different collection type maybe? So are you saying that your two arraylists have to be iterated in parallel? They have the same number of items and item N from the first arraylist is associated with item N from the second arraylist? If so, I'd recommend you create a new bean class containing the two associated properties, and build a single arraylist of those beans. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: iterate problem
ok. you are right. i created a class class1 with two properties. in the action class i create a bean with an arraylist of all class1 objects. in my view i then iterate thru the arraylist of the bean and display the two properties of type class1. works! thanks, oliver Am Son, 2002-03-10 um 19.00 schrieb David M. Karr: Oliver == Oliver Kiessler [EMAIL PROTECTED] writes: Oliver hi, Oliver my problem: Oliver i have a bean with two ArrayLists. my action class gets the results from Oliver the database and puts them into the appropriate Arraylist. Then the Oliver whole bean is appended to the session. Oliver so in my view page i would like to iterate thru the ArrayLists of my Oliver bean. BUT i need to generate a hyperlink with something like that: Oliver a href=link.do?name=*in here the value from arraylist1 from the Oliver bean**in here the value from arraylist2 from the bean*/abr Oliver .* next hyperlink* Oliver how do i have to use the logic:iterate tag? Oliver something like that apparently doesn't work Oliver logic:iterate name=bean property=arraylist1 id=a1 Oliver type=java.lang.String Oliver logic:iterate name=bean property=arraylist2 id=a2 Oliver type=java.lang.String Oliver a href=link.do?name=bean:write name=a1 /bean:write Oliver name=a2 //abr Oliver /logic:iterate Oliver /logic:iterate Oliver am i missing something? or do i have to populate my bean differently? Oliver Different collection type maybe? So are you saying that your two arraylists have to be iterated in parallel? They have the same number of items and item N from the first arraylist is associated with item N from the second arraylist? If so, I'd recommend you create a new bean class containing the two associated properties, and build a single arraylist of those beans. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- mailto: [EMAIL PROTECTED] web: http://www.linustar.de gnupg key: http://www.linustar.de/pgp/kiessler.gpg --- Ubi non accusator, ibi non judex. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Iterate problem
Hi The parts you show look correct to me. It seems that the problem lies in the code of method OverDueOrderView.getOrderNo(), which you have not copied to the mail. Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Iterate problem 10.07.2001 11:55 Please respond to struts-user Hi I have a question My Iterate tag goes like this logic:iterate id=view name=updateOrderForm property=views type =example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate Do I need **IndexId** here as an attribute in the iterate Tag ??? 'cos In my form bean when showing the above table there is a call to public OverDueOrderView getView(int index) { System.out.println( in side the getView of UpdateOrder Form + index); return (OverDueOrderView)views.get(index); } Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN What can be the problem -- IS it 'cos i'm not specifying indexId attribute in the iterate tag or something else ???
Re: Iterate problem
it is goes something like this . private String orderNo ; public String getOrderNo() { return orderNo ; } - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 8:28 AM Subject: Re: Iterate problem Hi The parts you show look correct to me. It seems that the problem lies in the code of method OverDueOrderView.getOrderNo(), which you have not copied to the mail. Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Iterate problem 10.07.2001 11:55 Please respond to struts-user Hi I have a question My Iterate tag goes like this logic:iterate id=view name=updateOrderForm property=views type =example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate Do I need **IndexId** here as an attribute in the iterate Tag ??? 'cos In my form bean when showing the above table there is a call to public OverDueOrderView getView(int index) { System.out.println( in side the getView of UpdateOrder Form + index); return (OverDueOrderView)views.get(index); } Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN What can be the problem -- IS it 'cos i'm not specifying indexId attribute in the iterate tag or something else ???
Re: Iterate problem
Sorry, I'am somewhat at a loss... I had a similar problem, where it helped composing the property-term to a variable first, and using double quotes for the property value: ... td % pVal = view[ + index+ ]+.orderNo; % html:text property=%=pVal% / /td ... but I never understood why (can anybody tell me?) Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Re: Iterate problem 10.07.2001 15:02 Please respond to struts-user it is goes something like this . private String orderNo ; public String getOrderNo() { return orderNo ; } - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 8:28 AM Subject: Re: Iterate problem Hi The parts you show look correct to me. It seems that the problem lies in the code of method OverDueOrderView.getOrderNo(), which you have not copied to the mail. Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Iterate problem 10.07.2001 11:55 Please respond to struts-user Hi I have a question My Iterate tag goes like this logic:iterate id=view name=updateOrderForm property=views type =example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate Do I need **IndexId** here as an attribute in the iterate Tag ??? 'cos In my form bean when showing the above table there is a call to public OverDueOrderView getView(int index) { System.out.println( in side the getView of UpdateOrder Form + index); return (OverDueOrderView)views.get(index); } Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN What can be the problem -- IS it 'cos i'm not specifying indexId attribute in the iterate tag or something else ???
RE: Iterate problem - Any Solutions !!!!!!
Hi Suhas, I seem to remember a problem with arrays being used in this way. Someone on this list created some new indexed tags you can grab from Teds site. Not certain but have a look at: http://www.husted.com/about/struts/resources.htm#contributions Specifically have a look at the Indexed Tags: http://husted.com/about/struts/indexed-tags.htm Jon. -Original Message- From: suhas [mailto:[EMAIL PROTECTED]] Sent: 10 July 2001 15:20 To: [EMAIL PROTECTED] Subject: Iterate problem - Any Solutions !! I still struggling with iterate problem still . Any solutions . I do have the proper getter methods in the OverDueOrderView . getting Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN logic:iterate id=view name=updateOrderForm property=views type=example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate - Original Message - From: suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 2:02 PM Subject: Re: Iterate problem it is goes something like this . private String orderNo ; public String getOrderNo() { return orderNo ; } - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 8:28 AM Subject: Re: Iterate problem Hi The parts you show look correct to me. It seems that the problem lies in the code of method OverDueOrderView.getOrderNo(), which you have not copied to the mail. Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Iterate problem 10.07.2001 11:55 Please respond to struts-user Hi I have a question My Iterate tag goes like this logic:iterate id=view name=updateOrderForm property=views type =example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate Do I need **IndexId** here as an attribute in the iterate Tag ??? 'cos In my form bean when showing the above table there is a call to public OverDueOrderView getView(int index) { System.out.println( in side the getView of UpdateOrder Form + index); return (OverDueOrderView)views.get(index); } Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN What can be the problem -- IS it 'cos i'm not specifying indexId attribute in the iterate tag or something else ???
Re: Iterate problem - Any Solutions !!!!!! - SOLVED FINALLY
Hi Suhas, No sure what you mean by that... By the way, do you have to have an array? If you make it a collection, you can do away with the index altogether! Dave suhas [EMAIL PROTECTED] on 07/10/2001 11:52:20 AM Please respond to [EMAIL PROTECTED]; Please respond to suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED], suhas [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: Iterate problem - Any Solutions !! - SOLVED FINALLY Another point - The iterate tag used here is just acting as a for loop . I mean the scripting variable it exposes is not at all useful in this scenario . Any comments ! Suhas - Original Message - From: suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Gregor Rayman [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 4:26 PM Subject: Re: Iterate problem - Any Solutions !! - SOLVED FINALLY It worked at last . No other change needed . This is how - logic:iterate id=element name=updateOrderForm property=views type=example.testorder.OverDueOrderView tr td html:text name=updateOrderForm property='%= view[ + index+ ]+.orderNo %' / /td td html:text name=updateOrderForm property='%= view[+ index+ ]+.salesDiv %' / /td td html:text name=updateOrderForm property='%= view[+ index+ ]+.productOrdered %' / /td /tr - Original Message - From: Jon.Ridgway [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 11:06 AM Subject: RE: Iterate problem - Any Solutions !! Hi Suhas, I seem to remember a problem with arrays being used in this way. Someone on this list created some new indexed tags you can grab from Teds site. Not certain but have a look at: http://www.husted.com/about/struts/resources.htm#contributions Specifically have a look at the Indexed Tags: http://husted.com/about/struts/indexed-tags.htm Jon. -Original Message- From: suhas [mailto:[EMAIL PROTECTED]] Sent: 10 July 2001 15:20 To: [EMAIL PROTECTED] Subject: Iterate problem - Any Solutions !! I still struggling with iterate problem still . Any solutions . I do have the proper getter methods in the OverDueOrderView . getting Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN logic:iterate id=view name=updateOrderForm property=views type=example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate - Original Message - From: suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 2:02 PM Subject: Re: Iterate problem it is goes something like this . private String orderNo ; public String getOrderNo() { return orderNo ; } - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 8:28 AM Subject: Re: Iterate problem Hi The parts you show look correct to me. It seems that the problem lies in the code of method OverDueOrderView.getOrderNo(), which you have not copied to the mail. Guido suhas [EMAIL PROTECTED] To: [EMAIL PROTECTED] ltech.com cc: Subject: Iterate problem 10.07.2001 11:55 Please respond to struts-user Hi I have a question My Iterate tag goes like this logic:iterate id=view name=updateOrderForm property=views type =example.testorder.OverDueOrderView tr td html:text property='%= view[ + index+ ]+.orderNo %' / /td td html:text property='%= view[+index+ ]+.salesDiv %' / /td td html:text property='%= view[+index+ ]+.productOrdered %' / /td /tr % index++ ;% /logic:iterate Do I need **IndexId** here as an attribute in the iterate Tag ??? 'cos In my form bean when showing the above table there is a call to public OverDueOrderView getView(int index) { System.out.println( in side the getView of UpdateOrder Form + index); return (OverDueOrderView)views.get(index); } Here I'm getting **in side the getView of UpdateOrder Form 0 ** printed with following error message javax.servlet.ServletException: Exception thrown by getter for view[0].orderNo of bean org.apache.struts.taglib.html.BEAN What can be the problem -- IS it 'cos i'm not specifying
Re: iterate problem
if u putting the orderedsandwiches in the session scope in action class , then no Need of having bean:define tag in the JSP . Also instead of keeping that in the session scope in the action class. U can very well populate the form bean with the contents of that array use following in JSP page . Here listOfSandwithces is the array attribute of the actionForm bean which logic:iterate id=element name=orderedsandwiches property=listOfSandwitches bean:write name=elementproperty=element logic:iterate - Original Message - From: Moons Manuel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 09, 2001 1:43 PM Subject: iterate problem Hello everyone. I am currently having some problems with iterating over an array of objects. In my action class I have put an array into the session object (request.getSession().setAttribute(orderedsandwiches,...);) I would like to loop over these objects in my jsp page. I am trying to do this like this: bean:define id=orderedsandwiches name=orderedsandwiches/ table logic:iterate id=element name=orderedsandwiches tr td bean:write name=element property=name/ /td /tr /logic:iterate /table But when I try to do this, I get an exception like the following: 9-jul-01 14:21:07 GMT+02:00 Error HTTP [WebAppServletContext(5325170,sandwich)] Root cause of ServletException javax.servlet.jsp.JspException: Cannot find bean element 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._viewall._jspService(_viewall.java:183) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :213) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:157) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1683) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1520) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:485) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :213) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:12 65) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1622) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) When I loop through the array using jsp snippets, I can print out the contents of the array like this: table % OrderBean []ob = (OrderBean[])orderedsandwiches; for(int i=0;iob.length;i++) { %trtd% out.println(ob[i]); %tdtr% } % /table The strange thing about all of this is that in another jsp page, I do almost the same thing and there this works without any problems. Does anyone have an idea to solve this problem
RE: iterate problem
Have you defined the struts-logic.tld at the top of your jsp? -Original Message- From: Moons Manuel [mailto:[EMAIL PROTECTED]] Sent: 09 July 2001 13:43 To: '[EMAIL PROTECTED]' Subject: iterate problem Hello everyone. I am currently having some problems with iterating over an array of objects. In my action class I have put an array into the session object (request.getSession().setAttribute(orderedsandwiches,...);) I would like to loop over these objects in my jsp page. I am trying to do this like this: bean:define id=orderedsandwiches name=orderedsandwiches/ table logic:iterate id=element name=orderedsandwiches tr td bean:write name=element property=name/ /td /tr /logic:iterate /table But when I try to do this, I get an exception like the following: 9-jul-01 14:21:07 GMT+02:00 Error HTTP [WebAppServletContext(5325170,sandwich)] Root cause of ServletException javax.servlet.jsp.JspException: Cannot find bean element 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._viewall._jspService(_viewall.java:183) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu bImpl.java :213) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDis patcherImp l.java:157) at org.apache.struts.action.ActionServlet.processActionForward(Action Servlet.ja va:1683) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1520) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:485) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu bImpl.java :213) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAp pServletCo ntext.java:12 65) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletReques tImpl.java :1622) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) When I loop through the array using jsp snippets, I can print out the contents of the array like this: table % OrderBean []ob = (OrderBean[])orderedsandwiches; for(int i=0;iob.length;i++) { %trtd% out.println(ob[i]); %tdtr% } % /table The strange thing about all of this is that in another jsp page, I do almost the same thing and there this works without any problems. Does anyone have an idea to solve this problem