Logic Iterate problem:
Logic Iterate problem: Can we have nested logic iterates? e.g. if I want to show list of products under all Categories. how can i implement that? I am having problem in setting the values of attributes for inner logic iterate loop logic:iterate id=category name=categorylist bean:write name=category property=categoryname/ logic:iterate id=products bean:write name=products / /logic:iterate /logic:iterate I have a bean catergory class which has productlist[] and catergoryname as its properties Thanks in advance Raman Garg
Re: Logic Iterate problem:
Look at the nested:iterate tag. Nice http://jakarta.apache.org/struts/userGuide/struts-nested.html -jeff On Monday, November 24, 2003, at 09:44 AM, Raman wrote: Logic Iterate problem: Can we have nested logic iterates? e.g. if I want to show list of products under all Categories. how can i implement that? I am having problem in setting the values of attributes for inner logic iterate loop logic:iterate id=category name=categorylist bean:write name=category property=categoryname/ logic:iterate id=products bean:write name=products / /logic:iterate /logic:iterate I have a bean catergory class which has productlist[] and catergoryname as its properties Thanks in advance Raman Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Iterate problem
Hi, I hava a userForm that has a ArrayList of User objects, each User object has several properties: fistname, lastname, age. How can I get all User's firstname, lastname, age in an iterate? Thanks. bruce
RE: checkbox and iterate problem
Sorry, my mistake, it is Boolean ActionForm reset method is ((OrderEntryLineItemForm) iterator.next()).setMarkedForRemoval(Boolean.FALSE); jsp is nested:checkbox property=markedForRemoval value=true/ Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:51 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I'm afraid you've lost me, I thought the propery HAD to be boolean for a checkbox. Can you please send me a code snippet of what you have working (even if its different then what I am trying to do). High level: I just want to read a list a of strings items from a DB, and then populate a form with the items and let the user select them or not. Thanx Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
checkbox and iterate problem
Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
I'm afraid you've lost me, I thought the propery HAD to be boolean for a checkbox. Can you please send me a code snippet of what you have working (even if its different then what I am trying to do). High level: I just want to read a list a of strings items from a DB, and then populate a form with the items and let the user select them or not. Thanx Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail
RE: checkbox and iterate problem
I got it working..Thank you for your assistance. I completely rewrote my code, and instead of using indexed=true, I constructed the property inline using %= blah % I'm not sure why I couldn;t get it working the first way, but now it works. Neal Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Map iterate problem
your MultiMap class does not have getKey() method which bean:write name=mm property=key/ translates to. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tuesday, November 12, 2002 10:18 AM To: Struts Users Mailing List Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Map iterate problem
I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ?
RE: Map iterate problem
Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? winmail.dat-- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Map iterate problem
That doesn't seem to help. When I try the same example where MultiMap extends the ActionForm Class, but it created as a form beam it work fine. Any ideas ? - Original Message - From: Hookom, Jacob John [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 4:19 PM Subject: RE: Map iterate problem Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: Map iterate problem
Title: Map iterate problem Or you can define your Map from MultiMap (Note: some changes made to MutiMap) public class MultiMap{public Map mymap = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put("foo","bar"); values.put("you","me"); } public Map getMyMap() { return myMap; }} then.bean:define id="yourMap" name="mm" scope="application" then simply iterate through yourMapHope this works.Vinh -Original Message-From: Hookom, Jacob John [mailto:[EMAIL PROTECTED]]Sent: Tuesday, November 12, 2002 10:19 AMTo: Struts Users Mailing ListSubject: RE: Map iterate problem Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:[EMAIL PROTECTED]] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init:servlet.getServletContext().setAttribute("mm", new MultiMap());The map is:public class MultiMap{public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put("foo","bar"); values.put("you","me"); } public Map getMap() { return values ; }}In the JSP I try to iterate over this map using (which doesn't throw any exceptions):logic:iterate id="map" name="mm" property="map"/logic:iterateHowever When I try to usebean:write name="mm" property="key"/I get:javax.servlet.jsp.JspException: No getter method for property key of beanmmWhat am I missing ? attachment: winmail.dat-- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Map iterate problem
Map iterate problemSorry that doesn't work From the documentation: id The name of a page scope JSP bean that will contain the current element of the collection on each iteration. but my bean is stored in the application scope: Unless my problem lies in my iterate tag ? - Original Message - From: Vinh Tran To: Struts Users Mailing List ; [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 4:45 PM Subject: RE: Map iterate problem sorry...forgot the property attribute... bean:define id=yourMap property=mymap name=mm scope=application -Original Message- From: Vinh Tran [mailto:vinht;processintelligence.com] Sent: Tuesday, November 12, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Or you can define your Map from MultiMap (Note: some changes made to MutiMap) public class MultiMap { public Map mymap = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); values.put(you,me); } public Map getMyMap() { return myMap; } } then.bean:define id=yourMap name=mm scope=application then simply iterate through yourMapHope this works.Vinh -Original Message- From: Hookom, Jacob John [mailto:hookomjj;uwec.edu] Sent: Tuesday, November 12, 2002 10:19 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? -- -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Map iterate problem Application Scope
Map iterate problemThe iterate examples seem to use Maps that are created in the PageScope. In the case of a Map-backed action form. However what I'm trying to do is iterate over a an Object placed in the application scope: a.k.a. I can't seem to get the logic:iterate to work even though the bean mm is sitting quite hapily in the application scope. servlet.getServletContext().setAttribute(mm, new MultiMap()); public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); } public Map getMap() { return values ; } } Is the possible ?
Re: Map iterate problem Application Scope
I actually had this problem with other objects (not necessarily maps) and it turned out that the logic and bean tags would only find my objects if I set them in the pageContext object, meaning I would have to do this in my JSP: % pageContext.setAttribute( mm pageContext.getServletContext().getAttribute(mm), pageContext.APPLICATION ); % ... It sucked, but it worked. Essentially the tags were always looking in the pageContext object and not the servletContext. Or maybe it was a problem with the pageContext implementation in Tomcat, don't know which. For JavaBeans, I could use a jsp:useBean tag that pointed to my bean and the tags would find it as well. So if I set a bean in session / request scope, say in an Action, I would have to use a jsp:useBean tag on the page that defined the bean that was already there. Robert Mark Ayad wrote: Map iterate problemThe iterate examples seem to use Maps that are created in the PageScope. In the case of a Map-backed action form. However what I'm trying to do is iterate over a an Object placed in the application scope: a.k.a. I can't seem to get the logic:iterate to work even though the bean mm is sitting quite hapily in the application scope. servlet.getServletContext().setAttribute(mm, new MultiMap()); public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() { values.put(foo,bar); } public Map getMap() { return values ; } } Is the possible ? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: Map iterate problem
Mark: Please include code otherwise I can't help youand include the error you are receiving. Vinh -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tuesday, November 12, 2002 11:05 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Map iterate problem Map iterate problemSorry that doesn't work From the documentation: id The name of a page scope JSP bean that will contain the current element of the collection on each iteration. but my bean is stored in the application scope: Unless my problem lies in my iterate tag ? - Original Message - From: Vinh Tran To: Struts Users Mailing List ; [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 4:45 PM Subject: RE: Map iterate problem sorry...forgot the property attribute... bean:define id=yourMap property=mymap name=mm scope=application -Original Message- From: Vinh Tran [mailto:vinht;processintelligence.com] Sent: Tuesday, November 12, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Or you can define your Map from MultiMap (Note: some changes made to MutiMap) public class MultiMap { public Map mymap = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() values.put(foo,bar); values.put(you,me); } public Map getMyMap() { return myMap; } } then.bean:define id=yourMap name=mm scope=application then simply iterate through yourMapHope this works.Vinh -Original Message- From: Hookom, Jacob John [mailto:hookomjj;uwec.edu] Sent: Tuesday, November 12, 2002 10:19 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? -- -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Map iterate problem Application Scope
One of thoes afternoons it all works now, I've attatche all the code urgh ? - Original Message - From: Vinh Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 6:15 PM Subject: RE: Map iterate problem Mark: Please include code otherwise I can't help youand include the error you are receiving. Vinh -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tuesday, November 12, 2002 11:05 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Map iterate problem Map iterate problemSorry that doesn't work From the documentation: id The name of a page scope JSP bean that will contain the current element of the collection on each iteration. but my bean is stored in the application scope: Unless my problem lies in my iterate tag ? - Original Message - From: Vinh Tran To: Struts Users Mailing List ; [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 4:45 PM Subject: RE: Map iterate problem sorry...forgot the property attribute... bean:define id=yourMap property=mymap name=mm scope=application -Original Message- From: Vinh Tran [mailto:vinht;processintelligence.com] Sent: Tuesday, November 12, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Or you can define your Map from MultiMap (Note: some changes made to MutiMap) public class MultiMap { public Map mymap = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() values.put(foo,bar); values.put(you,me); } public Map getMyMap() { return myMap; } } then.bean:define id=yourMap name=mm scope=application then simply iterate through yourMapHope this works.Vinh -Original Message- From: Hookom, Jacob John [mailto:hookomjj;uwec.edu] Sent: Tuesday, November 12, 2002 10:19 AM To: Struts Users Mailing List Subject: RE: Map iterate problem Your multimap must be an instance of java.util.Map to get logic:iterate to recognize/handle it properly. -Original Message- From: Mark Ayad [mailto:mark;javamark.com] Sent: Tue 11/12/2002 9:17 AM To: Struts Users Mailing List Cc: Subject: Map iterate problem I have a Map which I place into the Application Context using the following line in a plugin init: servlet.getServletContext().setAttribute(mm, new MultiMap()); The map is: public class MultiMap { public Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } public MultiMap() values.put(foo,bar); values.put(you,me); } public Map getMap() { return values ; } } In the JSP I try to iterate over this map using (which doesn't throw any exceptions): logic:iterate id=map name=mm property=map /logic:iterate However When I try to use bean:write name=mm property=key/ I get: javax.servlet.jsp.JspException: No getter method for property key of bean mm What am I missing ? -- -- -- -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org MemoryPlugin.java Description: java/ MultiMap.java Description: java/ test.jsp Description: Binary data -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Newbie iterate problem
I'm coming up to speed with Struts, and I can't seem to figure out the logic:iterate tag. I've got: logic:iterate id=logo name=logoForm property=logoMap ... bean:write name=logo property=number/ I keep getting a cannot find bean logo in scope null error. Do I have to have an instance of the bean in the request? I've tried specifying both session and request scoping, and I've specified the type of the bean, but I can't seem to get an instance created. Is this something that Struts is supposed to do, or is that something that is my responsibility? Thanks! -- Tracy Nelson Yes, learning Struts is a little like having bees live in your head. Butthere they are! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Newbie iterate problem
Hi Tracy. Your code looks correct, so you might try tracing through the iterate tag and the write tag to get a better idea of the problem. I had to do that several times before when I get those types of errors that aren't obvious. Start at the write tag to see what it is getting (and what it is trying to look up) and work your way back. Tim Nelson, Tracy (ETW) Tracy.Nelson @nike.com 08/12/2002To: Struts user list (E-mail) [EMAIL PROTECTED] 03:00 PM cc: Please respond to Struts Users Mailing ListSubject: Newbie iterate problem Caterpillar: Confidential Green Retain Until: 09/11/2002 Retention Category: G90 - Information and Reports I'm coming up to speed with Struts, and I can't seem to figure out the logic:iterate tag. I've got: logic:iterate id=logo name=logoForm property=logoMap ... bean:write name=logo property=number/ I keep getting a cannot find bean logo in scope null error. Do I have to have an instance of the bean in the request? I've tried specifying both session and request scoping, and I've specified the type of the bean, but I can't seem to get an instance created. Is this something that Struts is supposed to do, or is that something that is my responsibility? Thanks! -- Tracy Nelson Yes, learning Struts is a little like having bees live in your head. Butthere they are! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie iterate problem
Can you send the action declaration for this jsp (from the struts-config)? Example: actionpath=/doLogo type=com.company.Whatever attribute=logoForm scope=request validate=false forward name=success path=/displayLogo.jsp/ /action James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Nelson, Tracy (ETW) [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 4:01 PM To: Struts user list (E-mail) Subject: Newbie iterate problem I'm coming up to speed with Struts, and I can't seem to figure out the logic:iterate tag. I've got: logic:iterate id=logo name=logoForm property=logoMap ... bean:write name=logo property=number/ I keep getting a cannot find bean logo in scope null error. Do I have to have an instance of the bean in the request? I've tried specifying both session and request scoping, and I've specified the type of the bean, but I can't seem to get an instance created. Is this something that Struts is supposed to do, or is that something that is my responsibility? Thanks! -- Tracy Nelson Yes, learning Struts is a little like having bees live in your head. Butthere they are! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie iterate problem
| From: James Mitchell [mailto:[EMAIL PROTECTED]] | Sent: Monday, August 12, 2002 14:02 | | Can you send the action declaration for this jsp (from the | struts-config)? Here 'tis: action path=/selectLogo type=LogoSelectAction name=LogoSelectForm input=/LogoSelector.jsp forward name=success path=/LogoSelector.jsp/ /action I'm trying to compare the generated code between the sample application and mine, but I haven't seen anything yet that's given me a clue. Thanks! -- Tracy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie iterate problem
Sorry for taking so long to respond, I'm on a few other lists with pretty good traffic. Anyway, based on what you have given so far, make sure that LogoSelectAction is setting the correct form (the one defined as 'LogoSelectForm') in the correct scope. You can also verify this with a little 'snoop' code (I can send that to you if you want) in the jsp. Once you know for sure that that your formbean is in the request or session, make sure that the name is correct (this is case sensitive). Good Luck. James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Nelson, Tracy (ETW) [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 5:03 PM To: 'Struts Users Mailing List' Subject: RE: Newbie iterate problem | From: James Mitchell [mailto:[EMAIL PROTECTED]] | Sent: Monday, August 12, 2002 14:02 | | Can you send the action declaration for this jsp (from the | struts-config)? Here 'tis: action path=/selectLogo type=LogoSelectAction name=LogoSelectForm input=/LogoSelector.jsp forward name=success path=/LogoSelector.jsp/ /action I'm trying to compare the generated code between the sample application and mine, but I haven't seen anything yet that's given me a clue. Thanks! -- Tracy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie iterate problem
Hsorry, I misread your problem. What kind of Objects/Beans do getLogoMap() return from your formbean? You might try specifying the type= attribute in the iterate tag. Well, that's my best stab at what info is given. Good luck. James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 10:07 PM To: Struts Users Mailing List Subject: RE: Newbie iterate problem Sorry for taking so long to respond, I'm on a few other lists with pretty good traffic. Anyway, based on what you have given so far, make sure that LogoSelectAction is setting the correct form (the one defined as 'LogoSelectForm') in the correct scope. You can also verify this with a little 'snoop' code (I can send that to you if you want) in the jsp. Once you know for sure that that your formbean is in the request or session, make sure that the name is correct (this is case sensitive). Good Luck. James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Nelson, Tracy (ETW) [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 5:03 PM To: 'Struts Users Mailing List' Subject: RE: Newbie iterate problem | From: James Mitchell [mailto:[EMAIL PROTECTED]] | Sent: Monday, August 12, 2002 14:02 | | Can you send the action declaration for this jsp (from the | struts-config)? Here 'tis: action path=/selectLogo type=LogoSelectAction name=LogoSelectForm input=/LogoSelector.jsp forward name=success path=/LogoSelector.jsp/ /action I'm trying to compare the generated code between the sample application and mine, but I haven't seen anything yet that's given me a clue. Thanks! -- Tracy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Please help w Iterate problem
Hi all, I have a newby question - nobody's answered my previous questions so I feel like the invisible man on this list but here goes anyways (maybe I can guilt somebody into helping me) Using Struts 1.0/tiles I need to be able to iterate through a list of dynamic html:text fields. I'm not sure how to set up the data structure in the ActionForm to handle this. In my mind it's an array so I'm using an array list. I have no problem displaying the fields with bean:write but cannot seem to set the fields w html:text. Please help. Also: Being new to tags: Can I / should I use the Standard Tag Library tags with struts? I've done some jsp programming before but I'm having problems with using struts/tiles for the first time. I find that I'm finished the rest of the app. in a day or two and spend the next week wrestling with struts to create the presentation. Also: I have extensive java script libraries that I've build/downloaded. Since my applications are on a secured intranet users don't turn off javascript AND javascript is much, much, much faster than server side validation. What I would like to do is build the javascript functions into custome tags - can I / should I do this? Any general advice would be much appreciated. Cheers, Stan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Iterate problem: set ArrayList String value
Hi all, I have a newby question - nobody's answered my previous questions so I feel like the invisible man on this list but here goes anyways (maybe I can guilt somebody into helping me) Using Struts 1.0/tiles I need to be able to iterate through a list of dynamic html:text fields. I'm not sure how to set up the data structure in the ActionForm to handle this. In my mind it's an array so I'm using an array list. I have no problem displaying the fields with bean:write but cannot seem to set the fields w html:text. Please help. Also: Being new to tags: Can I / should I use the Standard Tag Library tags with struts? I've done some jsp programming before but I'm having problems with using struts/tiles for the first time. I find that I'm finished the rest of the app. in a day or two and spend the next week wrestling with struts to create the presentation. Also: I have extensive java script libraries that I've build/downloaded. Since my applications are on a secured intranet users don't turn off javascript AND javascript is much, much, much faster than server side validation. What I would like to do is build the javascript functions into custome tags - can I / should I do this? Any general advice would be much appreciated. Cheers, Stan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: DynaActionForm Struts iterate Problem
Hi, You can found a little (and temporaly) patch here : http://www.mycgiserver.com/~eboudrant/?nostat=true#dyna This bug should be resolved in next struts release. Bug: When we redisplay an DynaActionForm with indexed property, the value displayed is not the real value, but the address of the Array. This patch override the RequestUtils and BaseFieldTag classes. An indexed property is declared like this : form-property name=listName type=java.lang.String[]/ Important: You must initilize all your indexed property (new String[x]...) before display it. -Emmanuel Gopi Chand [EMAIL PROTECTED] a écrit : Hi,I got the same problem as u mentioned. For me also it is displaying address of String array ,instead of value. How u resolved this problem. Let me know.ThanksChand. - Chat with friends online, try MSN Messenger: Click Here - Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !
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]
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
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]
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]
iterate problem
hi, my problem: i have a bean with two ArrayLists. my action class gets the results from the database and puts them into the appropriate Arraylist. Then the whole bean is appended to the session. so in my view page i would like to iterate thru the ArrayLists of my bean. BUT i need to generate a hyperlink with something like that: a href=link.do?name=*in here the value from arraylist1 from the bean**in here the value from arraylist2 from the bean*/abr .* next hyperlink* . . . how do i have to use the logic:iterate tag? something like that apparently doesn't work logic:iterate name=bean property=arraylist1 id=a1 type=java.lang.String logic:iterate name=bean property=arraylist2 id=a2 type=java.lang.String a href=link.do?name=bean:write name=a1 /bean:write name=a2 //abr /logic:iterate /logic:iterate am i missing something? or do i have to populate my bean differently? Different collection type maybe? thanks, oliver -- 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]
relatively complicated iterate problem.
Hello all, I am trying to create a table where Its columns will be generated dynamically. I coded something like this which works quite fine, logic:iterate id=UserAdmin name=UserAdminFormBean property=listrowcontent indexId=index offset=0 TR TDSome other UserAdmin class properties.../TD logic:iterate id=Roll name=UserAdmin property=listrolecontent indexId=inner TDINPUT type='checkbox' logic:equal name=Roll property=name value=true checked /logic:equal / /TD /logic:iterate /TR /logic:iterate UserAdminFormBean: A formbean listrowcontent: A vector, presumably made up of UserAdmin instances. UserAdmin: A helper class listrolecontent: A vector property in UserAdmin helper class. Which is currently made up of Roll classes Roll: A helper class which only holds one String property name: A String property in the Roll table. My problem is. I don't want to use Roll class, since it only contains a string. I have just created this Roll class, since I couln't find any way to make it run with struts. What do you think? is there any other way to do same thing? By the way, strangely it works with this code. form:select name='AuditActionFormBean' property=selectedstatus onchange='form.submit()' form:options name=AuditActionFormBean property=listauditstatus/ /form:select where AuditActionFormBean is bean and listauditstatus is a vector populated with Strings. Thanks a lot, Fehmi. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: relatively complicated iterate problem.
My problem is. I don't want to use Roll class, since it only contains a string. I have just created this Roll class, since I couln't find any way to make it run with struts. What do you think? is there any other way to do same thing? If you don't specify the property attribute, the tag will do a string comparison. I've got code like this in a working project: logic:equal name=resultsSize value=0 that works with a variable created by bean:size earlier in the page. -- Sent via jApache.org -- 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 ???
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 !!!!!!
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
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
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
Iterate problem
Hi I have a question My Iterate tag goes like this logic:iterate id="view" name="updateOrderForm"property="views" type="example.testorder.OverDueOrderView" trtdhtml:text property='%= "view[" + index+ "]"+".orderNo" %' / /tdtdhtml:text property='%= "view["+index+ "]"+".salesDiv" %' //tdtdhtml: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 ???