RE: PLEASE HELP: How would I use the iterate tag here?
Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ /TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
Re: PLEASE HELP: How would I use the iterate tag here?
Here's what I do in some code, if it's any help - am sure you can manipulate it: logic:iterate id="parameter" name="ParametersForm" property="parameterList" TR TD WIDTH="50%"FONT SIZE="2" FACE="Helvetica,Verdana,Arial" COLOR="BLACK" bean:write name="parameter" property="key"//FONT /TD TD WIDTH="50%"FONT SIZE="2" FACE="Helvetica,Verdana,Arial" html:text name="parameter" property="value" size="30"//FONT /TD /TR /logic:iterate David Shamdasani Nimmi-ANS004 [EMAIL PROTECTED] on 02/28/2001 04:22:40 PM Please respond to [EMAIL PROTECTED] To: "'[EMAIL PROTECTED]'" [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: PLEASE HELP: How would I use the iterate tag here? Hi, Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. --- jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ /TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE --- I can really use some help. Thanks in advance -Nimmi
RE: PLEASE HELP: How would I use the iterate tag here?
Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
Are you using an older JDK? This tag requires JDK 1.2 or later. Just a thought, Dave -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:02 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
No, I am using JDK 1.3 -Nimmi -Original Message- From: D'Orto, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:11 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Are you using an older JDK? This tag requires JDK 1.2 or later. Just a thought, Dave -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:02 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
Re: PLEASE HELP: How would I use the iterate tag here?
Yes, there is. See Craig McClanahan's explanation in the archives: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg03625.html Hope this helps. -- Martin Cooper Tumbleweed Communications - Original Message - From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:02 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
Are the taglibs defined properly (in the jsp and in web.xml)? Do any struts tags work? -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:13 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? No, I am using JDK 1.3 -Nimmi -Original Message- From: D'Orto, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:11 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Are you using an older JDK? This tag requires JDK 1.2 or later. Just a thought, Dave -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:02 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
Re: PLEASE HELP: How would I use the iterate tag here?
Before your loop, try to setCollection() / getCollection() and check getLength(). This way you will know exactly, if you are getting your data. Shamdasani Nimmi-ANS004 wrote: No, I am using JDK 1.3 -Nimmi -Original Message- From: D'Orto, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:11 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Are you using an older JDK? This tag requires JDK 1.2 or later. Just a thought, Dave -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:02 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
Martin, According to Craig's email: -- When you iterate over a Hashtable (or any other Map), the elements of the iteration are of class "Map.Entry", which has two properties -- "key" and "value". logic:iterate id="impl" name="loadImpl" property="impl" The curent value is bean:write name="impl" property="value"/ /logic:iterate - Since the "value" in my case is of the type SupplierBean how would I get access to the properties of SupplierBean? -Nimmi -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:19 PM To: [EMAIL PROTECTED] Subject: Re: PLEASE HELP: How would I use the iterate tag here? Yes, there is. See Craig McClanahan's explanation in the archives: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg03625.html Hope this helps. -- Martin Cooper Tumbleweed Communications - Original Message - From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:02 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here?
What Craig is saying here seems inconsistant with the docs for iterate: ... a Map (whose values are to be iterated over), ... However you could add this line right inside of the loop bean:define id="supplier" name="supplierMapEntry" property="value" type="com.full.package.SupplierBean"/ Also you would need to change the id in the iterate to "supplierMapEntry" Wes Martin, According to Craig's email: -- When you iterate over a Hashtable (or any other Map), the elements of the iteration are of class "Map.Entry", which has two properties -- "key" and "value". logic:iterate id="impl" name="loadImpl" property="impl" The curent value is bean:write name="impl" property="value"/ /logic:iterate - Since the "value" in my case is of the type SupplierBean how would I get access to the properties of SupplierBean? -Nimmi
RE: PLEASE HELP: How would I use the iterate tag here?
Wes, I did try the code below but it still doesn't work. Anyone has any other suggestion? Imagine all this trouble when all I want to do is to make my "WORKING" JSP code look cleaner by using iterate tag: TABLE logic:iterate id="supplierMapEntry" name="user" property="suppliers" bean:define id="supplier" name="supplierMapEntry" property="value" type="com.motorola.mms.msqc.beans.SupplierBean"/ TR TDFONT face = "Arial"bean:write name="supplier" property="code"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="name"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="countryName"//FONT/TD /TR /logic:iterate /TABLE -- This is what I am trying to replace: jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE
Re: PLEASE HELP: How would I use the iterate tag here?
You should be able to use nested properties: bean:write name="item" property="value.code"/ bean:write name="item" property="value.country"/ bean:write name="item" property="value.countryName"/ -- Martin Cooper Tumbleweed Communications - Original Message - From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:25 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Martin, According to Craig's email: -- When you iterate over a Hashtable (or any other Map), the elements of the iteration are of class "Map.Entry", which has two properties -- "key" and "value". logic:iterate id="impl" name="loadImpl" property="impl" The curent value is bean:write name="impl" property="value"/ /logic:iterate - Since the "value" in my case is of the type SupplierBean how would I get access to the properties of SupplierBean? -Nimmi -----Original Message----- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:19 PM To: [EMAIL PROTECTED] Subject: Re: PLEASE HELP: How would I use the iterate tag here? Yes, there is. See Craig McClanahan's explanation in the archives: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg03625.html Hope this helps. -- Martin Cooper Tumbleweed Communications - Original Message ----- From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:02 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -----Original Message----- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -----Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName() %/FONT/TD /TR % } % /TABLE table logic:iterate id="supplier" name="user" property="suppliers" type="com.full.packagename.for.SupplierBean" trtdfont face="Arial"bean:write name="supplier" property="code"//td/tr trtdfont face="Arial"bean:write name="supplier" property="name"//td/tr trtdfont face="Arial"bean:write name="supplier" property="countryName"//td/tr /tr /logic:iterate /table Be sure to fix the package name in the type attr in logic:iterate. This also assumes that there is an object in the session scope called user. Wes
RE: PLEASE HELP: How would I use the iterate tag here? Where are you Craig McClanahan?
I have tried both of the ways below without any luck: logic:iterate id="supplier" name="user" property="suppliers" TR TDFONT face = "Arial"bean:write name="supplier" property="value.code"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="value.name"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="countryName"//FONT/TD /TR /logic:iterate and I have tried this: logic:iterate id="supplierMapEntry" name="user" property="suppliers" bean:define id="supplier" name="supplierMapEntry" property="value" type="com.motorola.mms.msqc.beans.SupplierBean"/ TR TDFONT face = "Arial"bean:write name="supplier" property="code"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="name"//FONT/TD TDFONT face = "Arial"bean:write name="supplier" property="countryName"//FONT/TD /TR /logic:iterate -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 5:38 PM To: [EMAIL PROTECTED] Subject: Re: PLEASE HELP: How would I use the iterate tag here? You should be able to use nested properties: bean:write name="item" property="value.code"/ bean:write name="item" property="value.country"/ bean:write name="item" property="value.countryName"/ -- Martin Cooper Tumbleweed Communications - Original Message - From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:25 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Martin, According to Craig's email: -- When you iterate over a Hashtable (or any other Map), the elements of the iteration are of class "Map.Entry", which has two properties -- "key" and "value". logic:iterate id="impl" name="loadImpl" property="impl" The curent value is bean:write name="impl" property="value"/ /logic:iterate - Since the "value" in my case is of the type SupplierBean how would I get access to the properties of SupplierBean? -Nimmi -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 4:19 PM To: [EMAIL PROTECTED] Subject: Re: PLEASE HELP: How would I use the iterate tag here? Yes, there is. See Craig McClanahan's explanation in the archives: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg03625.html Hope this helps. -- Martin Cooper Tumbleweed Communications - Original Message - From: "Shamdasani Nimmi-ANS004" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 2:02 PM Subject: RE: PLEASE HELP: How would I use the iterate tag here? Is there a problem that getSuppliers() method returns a Hashtable and not an ArrayList? -Nimmi -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:59 PM To: '[EMAIL PROTECTED]' Subject: RE: PLEASE HELP: How would I use the iterate tag here? Wes, I did try your code(and this is what I was trying before myself too) but the table still comes out to be blank whereas if I use the code below the supplier rows are displayed. So what's the problem? Anyone else with suggestions? -Nimmi -Original Message- From: Wes Hodges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 28, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: RE: PLEASE HELP: How would I use the iterate tag here? Could someone help me with replacing the JSP code below with iterate tag logic:iterate ? I have tried various permutations of logic:iterate but have been unsuccessful. -- - jsp:useBean id="user" scope="session" type="com.motorola.mms.msqc.beans.UserBean"/ TABLE % Hashtable hashTable = (Hashtable) user.getSuppliers(); for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) { SupplierBean supplier = (SupplierBean) e.nextElement(); % TR TD FONT face = "Arial"supplier.getCode() %/FONT/TD TDFONT face = "Arial"%= supplier.getName() %/FONT/TD/FONT/TD TDFONT face = "Arial"%= supplier.getCountryName