Re: logic:iterate and bean:write not showing when jstl c:out does
If the page is loading without errors but not rendering those tags, the most likely cause is missing taglib directives. Check the HTML source that gets generated to see if the tags are coming through as written in the JSP; if so, that's almost certainly what's wrong. L. Stephen Souness wrote: Hi all, I am using Struts 1.2.7, under Tomcat 5.0.25. I have a JSP within my struts application which I ultimately want to have output some checkboxes (using html:multibox). Other areas of my application use LabelValueBean with html:multibox and bean:write just fine. However, this particular area of my application has a few differing requirements and is not behaving the way I had hoped. The key difference is that this particular area of the application involves a FormBean which is shared across several pages, and is stored in session scope. I think that the action is correct in adding the Form like so: request.getSession().setAttribute(myForm, myForm); The JSP which acts as the view for the action can display attributes from the form if I refer to them using JSTL tags, but if I refer to the same attributes through struts tags, e.g. logic:iterate id=myLabelValueBean name=myForm property=myLabelValueBeans bean:write name=myLabelValueBean property=label scope=session / /logic:iterate the page finishes loading and displays nothing at all. I've seen behaviour like this in the past when a list is not being populated, but I am quite certain that this is not the case. Does anyone have any advice on what else I should be looking out for? (Logging to enable? etc.) This is the third project using Struts that I have worked on, so I hope this does not turn out to be a newbie issue :) -- Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate and bean:write not showing when jstl c:out does
Hi all, I am using Struts 1.2.7, under Tomcat 5.0.25. I have a JSP within my struts application which I ultimately want to have output some checkboxes (using html:multibox). Other areas of my application use LabelValueBean with html:multibox and bean:write just fine. However, this particular area of my application has a few differing requirements and is not behaving the way I had hoped. The key difference is that this particular area of the application involves a FormBean which is shared across several pages, and is stored in session scope. I think that the action is correct in adding the Form like so: request.getSession().setAttribute(myForm, myForm); The JSP which acts as the view for the action can display attributes from the form if I refer to them using JSTL tags, but if I refer to the same attributes through struts tags, e.g. logic:iterate id=myLabelValueBean name=myForm property=myLabelValueBeans bean:write name=myLabelValueBean property=label scope=session / /logic:iterate the page finishes loading and displays nothing at all. I've seen behaviour like this in the past when a list is not being populated, but I am quite certain that this is not the case. Does anyone have any advice on what else I should be looking out for? (Logging to enable? etc.) This is the third project using Struts that I have worked on, so I hope this does not turn out to be a newbie issue :) -- Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write logic:iterate for the Collection of HashMap.
Hi Amol, please see http://struts.apache.org/userGuide/struts-logic.html especially the section on maps. logic:iterate id=element name=myhashtable Next element is bean:write name=element property=value/ with key bean:write name=element property=key/ /logic:iterate Jurn At 10:06 PM 18/08/2005, Amol Yadwadkar wrote: Hello List, I need to display the results stored in the Hashmap. How can I achieve it by using logic:iterate I know the way to do it for List type data. Can anyone help me in this ? Thankx n regds, Amol - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to write logic:iterate for the Collection of HashMap.
Hello List, I need to display the results stored in the Hashmap. How can I achieve it by using logic:iterate I know the way to do it for List type data. Can anyone help me in this ? Thankx n regds, Amol
Re: accessing variables using logic:iterate
Dave wrote : As a followup, you may want to consider switching to JSTL for straight-forward tasks such as this: where functionality is duplicated between the Struts tags and JSTL it's generally recommended to go the JSTL route. It's a trivial switch to make, and can be done mechanically in most cases. I totally agree with this statement. In addition of being a way to get more genericity in the JSP, it is (IMO) quite more coherent. What I really dislike with struts tags is that attributes don't always mean the same thing from tag to tag, which is disturbing. I'm mainly thinking of the name and property, and .*Name attributes too. -- Stéphane ZUCKERMAN - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: accessing variables using logic:iterate
Stéphane Zuckerman wrote: What I really dislike with struts tags is that attributes don't always mean the same thing from tag to tag, which is disturbing. I'm mainly thinking of the name and property, and .*Name attributes too. Ah, I'm glad to hear I'm not the only one that is wogged by this. *sigh* Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
accessing variables using logic:iterate
Hi, Currently I have a action class which does session.setAttribute(recurringTaskSummary,v_recurringTaskSummary), where v_recurringTaskSummary is a vector of type SpRecurringTaskSummary which has certain variables such as EmployeeName, EmployeeRef etc. I am using logic:iterate as follows: logic:iterate id = rtSummary name=recurringTaskSummary bean:write name=rtSummary/ /logic:iterate The output is name of objects. However I want to somehow access the variables employeename, employeeref etc. How do I do that ? Thanks, Jay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing variables using logic:iterate
Hi Jay, session.setAttribute(recurringTaskSummary,v_recurringTaskSummary), SpRecurringTaskSummary [...] has certain variables such as EmployeeName, EmployeeRef etc. I am using logic:iterate as follows: logic:iterate id = rtSummary name=recurringTaskSummary bean:write name=rtSummary/ /logic:iterate The output is name of objects. However I want to somehow access the variables employeename, employeeref etc. How do I do that ? Just do something like : logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate Don't forget to use the bean naming conventions, though. -- Stéphane ZUCKERMAN - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing variables using logic:iterate
Stéphane Zuckerman wrote: I am using logic:iterate as follows: logic:iterate id = rtSummary name=recurringTaskSummary bean:write name=rtSummary/ /logic:iterate The output is name of objects. However I want to somehow access the variables employeename, employeeref etc. How do I do that ? logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate Don't forget to use the bean naming conventions, though. As a followup, you may want to consider switching to JSTL for straight-forward tasks such as this: where functionality is duplicated between the Struts tags and JSTL it's generally recommended to go the JSTL route. It's a trivial switch to make, and can be done mechanically in most cases. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing variables using logic:iterate
HI, When i do : logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate it says not getter for employeeName in bean rtsummary. 'recurringTaskSummary' is a vector and not a bean. I tried using the attribute type=SpRecurringTaskSummary but got the same error. I think I am missing the big picture or something basic in logic:iterate. Thanks, Jay On 8/16/05, Stéphane Zuckerman [EMAIL PROTECTED] wrote: Hi Jay, session.setAttribute(recurringTaskSummary,v_recurringTaskSummary), SpRecurringTaskSummary [...] has certain variables such as EmployeeName, EmployeeRef etc. I am using logic:iterate as follows: logic:iterate id = rtSummary name=recurringTaskSummary bean:write name=rtSummary/ /logic:iterate The output is name of objects. However I want to somehow access the variables employeename, employeeref etc. How do I do that ? Just do something like : logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate Don't forget to use the bean naming conventions, though. -- Stéphane ZUCKERMAN - 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: accessing variables using logic:iterate
Jay Sheth wrote: HI, When i do : logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate it says not getter for employeeName in bean rtsummary. 'recurringTaskSummary' is a vector and not a bean. I tried using the attribute type=SpRecurringTaskSummary but got the same error. I think I am missing the big picture or something basic in logic:iterate. (1) The 'type' attribute expects a full classname, but that's probably not relevant here. (2) What he was saying was that the Vector's objects must follow JavaBean naming conventions. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing variables using logic:iterate
Thanks a lot. Got it. As you said, the naming conventions were followed, but I made a typo in the property attribute. Sorry for the trouble. Jay On 8/16/05, Dave Newton [EMAIL PROTECTED] wrote: Jay Sheth wrote: HI, When i do : logic:iterate id=rtSummary name=recurringTaskSummary bean:write name=rtSummary property=employeeName/ /logic:iterate it says not getter for employeeName in bean rtsummary. 'recurringTaskSummary' is a vector and not a bean. I tried using the attribute type=SpRecurringTaskSummary but got the same error. I think I am missing the big picture or something basic in logic:iterate. (1) The 'type' attribute expects a full classname, but that's probably not relevant here. (2) What he was saying was that the Vector's objects must follow JavaBean naming conventions. Dave - 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: logic:iterate tag and form beans
Ok, If I am understanding the question correctly, you should be populating your array list in your bean with a objects of whatever represents a table row (such as an employee object), this object should have the attributes (name, id, address) you would like to render in the columns. Each object in the array will wind up being a table row. -Original Message- From: Brian Kremmin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 02, 2005 11:02 AM To: user@struts.apache.org Subject: logic:iterate tag and form beans Hello Everyone, This is my first post. I've been watching the list for a while now and I've hit a dead end. This is probably quite simple so any help would be greatly appreciated. I want to get some table data from a database and output it in table form on a webpage. I'm planning to use an ArrayList to store the data and use the logic:iterate tag to expose the elements of the list... however, I'm unsure of the proper structure of all these data objects. I think I'm using struts 1.1 if that makes a difference. I'm assuming I'll create a form bean with an ArrayList as a property.. is this correct? However, I'm unsure of what sort of objects to put into the array list. Do I create another form bean with properties for each table column, populate a new bean for each row of table data, and put each into the ArrayList? Or should the objects in the Arraylist be something other than a form bean? I'm looking for the 'best' and 'proper practice as our standards group is very picky. Any ideas? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate tag and form beans
Example: DataBean: public class EmployeeBean(){ private String name = null; Private String dept = null; ... Getters and setters } FormBean: public class EmployeeForm extends ActionForm{ private Collection employees = new ArrayList(); ... Getters and Setters } ActionClass: public ActionForward execute(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) { EmployeeForm empForm = (EmployeeForm) form; //getEmployeesFromDatabase should return a collection of EmployeeBeans empForm.setEmployees(getEmployeesFromDatabase()); return mapping.findForward(display); } JSP: table trthName/th thDept/th html:form action=xyz method=post logic:iterate id=emp name=EmployeeForm property=employees trtdhtml:text property=name//td tdhtml:text property=dept//td /tr /logic:iterate /html:form People are conversing... without posting their email or filling up their mail box. roomity.com http://roomity.com/launch.jsp No sign up to read or search this Rich Internet App ~~1122996240050~~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate tag and form beans
Brian Kremmin wrote: I'm planning to use an ArrayList to store the data and use the logic:iterate tag to expose the elements of the list... however, I'm unsure of the proper structure of all these data objects. I think I'm using struts 1.1 if that makes a difference. 1) I'd tend towards using JSTL rather than the Struts tags when the functionality is identical. 2) Put an ArrayList of JavaBeans into the appropriate scope (probably request?) IOW, your ArrayList will contain a collection of JavaBeans with getters for each column you want exposed. Say you have a user represented by firstname, lastname, and ssn. So your bean would have getFirstname, getLastname, and getSsn methods. In your Action you'd do something like: request.setAttribute(users, userArrayList); In your JSP you'd do something like (in JSTL; struts beans are quite similar): table c:forEach items=${users} var=user tr tdc:out value=${user.firstname}/ c:out value=${user.lastname}//td tdc:out value=${user.ssn}//td /tr /c:forEach /table or whatever. Again, the hour or two of investment in learning JSTL is worth it for tags that don't explicitly need Struts functionality, but on a practical level that may not make any difference to you. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate tag and form beans
Brian Kremmin wrote: I want to get some table data from a database and output it in table form on a webpage. I'm planning to use an ArrayList to store the data and use the logic:iterate tag to expose the elements of the list... however, I'm unsure of the proper structure of all these data objects. I think I'm using struts 1.1 if that makes a difference. I'm assuming I'll create a form bean with an ArrayList as a property.. is this correct? However, I'm unsure of what sort of objects to put into the array list. Do I create another form bean with properties for each table column, populate a new bean for each row of table data, and put each into the ArrayList? Or should the objects in the Arraylist be something other than a form bean? If you just need to display the data, you don't need FormBeans or anything else Struts-specific. Use whatever data structures make sense to your application and pass them to your view (JSP), as others have posted here. If you need to let the user edit and re-submit the data, validate it, re-display it, etc. then you will want to start using FormBeans and the rest of the Struts machinery to manage that. For output-only data, you just need to expose the model (whatever form you choose for that). Struts is model-agnostic. I'm looking for the 'best' and 'proper practice as our standards group is very picky. Any ideas? If you need to satisfy a picky standards group maybe you should ask what *they* consider to be the 'correct' way to do this in your organization :-) L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate - question
hi, I've got: ArrayList offices array of office objects. On jsp page i'm showing this array using logic:iterate. But i would like to show just only some objects of this array list, which meet some condition. It is possible? Best Regards, p. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: logic:iterate - question
Sure logic:iterate name=foo type=OfficeObject id=ob logic:equal name=ob property=aProperty value=your_condition_value html render object /logic::equal /logic:iterate -Ursprüngliche Nachricht- Von: peceka [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 30. Juli 2005 20:39 An: user@struts.apache.org Betreff: logic:iterate - question hi, I've got: ArrayList offices array of office objects. On jsp page i'm showing this array using logic:iterate. But i would like to show just only some objects of this array list, which meet some condition. It is possible? Best Regards, p. - 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: Not getting submitted values from textarea in logic:iterate
Hello: Does anyone have any ideas on how to get this to work? Is this a bug? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 20, 2005 10:41 AM To: 'Struts Users Mailing List' Subject: Not getting submitted values from textarea in logic:iterate Hello: I have a DynaForm with some beans stored in an array: form-bean name=admin.editClubForm type=org.apache.struts.validator.DynaValidatorForm form-property name=features type=persistent.Feature[]/ /form-bean I have the form-bean declared as session scope for my actions: action path=/admin/editClubInit type=admin.EditClubInit name=admin.editClubForm scope=session forward name=success path=/admin/editClub.do/ /action action path=/admin/editClub forward=admin.editClub / action path=/admin/editClubAction type=admin.EditClubAction name=admin.editClubForm scope=session forward name=failure path=/admin/editClub.do/ forward name=success path=/admin/showClubs.do redirect=true / /action The persistent.Feature class has a field text with setText and getText accessors. When want want to display the data, I first call /admin/editClubInit to populate the DynaForm. Here is the code that does that: Feature[] features = new Feature[NUM_FEATURES]; for( int i=0; iNUM_FEATURES; i++ ) { features[i] = new persistent.Feature(Test [+i+]); } df.set(features, features); After populating the form, the EditClubInit action forwards to user to the page to display the form. Here is the JSP code that shows the data: logic:iterate name=admin.editClubForm property=features id=feature br html:textarea name=feature property=text indexed=true rows=3 cols=75/ /logic:iterate The data appears correctly on the page. Unfortunately, when I submit the form to my action class to process it, I do not get the text I submitted. I get the original text that EditClubInit prepopulated the form with. Here is the code I am using to retrieve the data: Feature[] features = (Feature[]) df.get(features); for( int i=0; ifeatures.length; i++ ) { System.err.println( Feature[+i+] is +features[i].getText()); } Any ideas why this would not be working? If you need to see more details, I can provide them. I was trying to focus on what I thought would be helpful. Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com - 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: Not getting submitted values from textarea in logic:iterate
Your html:textarea/ tag is using the 'name' attribute, which tells it to associate itself with a specific bean instead of the containing form bean. html:textarea name=feature property=text indexed=true rows=3 cols=75/ This binds the text area to the property named 'text' on the 'feature' bean defined by the enclosing logic:iterate/. That's not what you want. If you look at the request when you submit the form I think you'll find that the values from the text areas are submitted through a request parameter named 'text'. Try this instead: html:textarea property=features value=${feature}/ You might also be able to do something like html:textarea property=features[${i}]/ if you add indexId=i to your logic:iterate/ tag. L. Neil Aggarwal wrote: Hello: Does anyone have any ideas on how to get this to work? Is this a bug? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 20, 2005 10:41 AM To: 'Struts Users Mailing List' Subject: Not getting submitted values from textarea in logic:iterate Hello: I have a DynaForm with some beans stored in an array: form-bean name=admin.editClubForm type=org.apache.struts.validator.DynaValidatorForm form-property name=features type=persistent.Feature[]/ /form-bean I have the form-bean declared as session scope for my actions: action path=/admin/editClubInit type=admin.EditClubInit name=admin.editClubForm scope=session forward name=success path=/admin/editClub.do/ /action action path=/admin/editClub forward=admin.editClub / action path=/admin/editClubAction type=admin.EditClubAction name=admin.editClubForm scope=session forward name=failure path=/admin/editClub.do/ forward name=success path=/admin/showClubs.do redirect=true / /action The persistent.Feature class has a field text with setText and getText accessors. When want want to display the data, I first call /admin/editClubInit to populate the DynaForm. Here is the code that does that: Feature[] features = new Feature[NUM_FEATURES]; for( int i=0; iNUM_FEATURES; i++ ) { features[i] = new persistent.Feature(Test [+i+]); } df.set(features, features); After populating the form, the EditClubInit action forwards to user to the page to display the form. Here is the JSP code that shows the data: logic:iterate name=admin.editClubForm property=features id=feature br html:textarea name=feature property=text indexed=true rows=3 cols=75/ /logic:iterate The data appears correctly on the page. Unfortunately, when I submit the form to my action class to process it, I do not get the text I submitted. I get the original text that EditClubInit prepopulated the form with. Here is the code I am using to retrieve the data: Feature[] features = (Feature[]) df.get(features); for( int i=0; ifeatures.length; i++ ) { System.err.println( Feature[+i+] is +features[i].getText()); } Any ideas why this would not be working? If you need to see more details, I can provide them. I was trying to focus on what I thought would be helpful. Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Not getting submitted values from textarea in logic:iterate
Laurie: I need to get the value of the text field from the feature bean, not just the feature bean itself. So, I had the change your code to: logic:iterate name=admin.editClubForm property=features id=feature indexId=i html:textarea property=features[${i}].text value=${feature.text} rows=3 cols=75/ /logic:iterate And it worked perfectly. Thanks for tip! Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Thursday, July 21, 2005 5:04 PM To: user@struts.apache.org Subject: Re: Not getting submitted values from textarea in logic:iterate Your html:textarea/ tag is using the 'name' attribute, which tells it to associate itself with a specific bean instead of the containing form bean. html:textarea name=feature property=text indexed=true rows=3 cols=75/ This binds the text area to the property named 'text' on the 'feature' bean defined by the enclosing logic:iterate/. That's not what you want. If you look at the request when you submit the form I think you'll find that the values from the text areas are submitted through a request parameter named 'text'. Try this instead: html:textarea property=features value=${feature}/ You might also be able to do something like html:textarea property=features[${i}]/ if you add indexId=i to your logic:iterate/ tag. L. Neil Aggarwal wrote: Hello: Does anyone have any ideas on how to get this to work? Is this a bug? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: Neil Aggarwal [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 20, 2005 10:41 AM To: 'Struts Users Mailing List' Subject: Not getting submitted values from textarea in logic:iterate Hello: I have a DynaForm with some beans stored in an array: form-bean name=admin.editClubForm type=org.apache.struts.validator.DynaValidatorForm form-property name=features type=persistent.Feature[]/ /form-bean I have the form-bean declared as session scope for my actions: action path=/admin/editClubInit type=admin.EditClubInit name=admin.editClubForm scope=session forward name=success path=/admin/editClub.do/ /action action path=/admin/editClub forward=admin.editClub / action path=/admin/editClubAction type=admin.EditClubAction name=admin.editClubForm scope=session forward name=failure path=/admin/editClub.do/ forward name=success path=/admin/showClubs.do redirect=true / /action The persistent.Feature class has a field text with setText and getText accessors. When want want to display the data, I first call /admin/editClubInit to populate the DynaForm. Here is the code that does that: Feature[] features = new Feature[NUM_FEATURES]; for( int i=0; iNUM_FEATURES; i++ ) { features[i] = new persistent.Feature(Test [+i+]); } df.set(features, features); After populating the form, the EditClubInit action forwards to user to the page to display the form. Here is the JSP code that shows the data: logic:iterate name=admin.editClubForm property=features id=feature br html:textarea name=feature property=text indexed=true rows=3 cols=75/ /logic:iterate The data appears correctly on the page. Unfortunately, when I submit the form to my action class to process it, I do not get the text I submitted. I get the original text that EditClubInit prepopulated the form with. Here is the code I am using to retrieve the data: Feature[] features = (Feature[]) df.get(features); for( int i=0; ifeatures.length; i++ ) { System.err.println( Feature[+i+] is +features[i].getText()); } Any ideas why this would not be working? If you need to see more details, I can provide them. I was trying to focus on what I thought would be helpful. Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie
Not getting submitted values from textarea in logic:iterate
Hello: I have a DynaForm with some beans stored in an array: form-bean name=admin.editClubForm type=org.apache.struts.validator.DynaValidatorForm form-property name=features type=persistent.Feature[]/ /form-bean I have the form-bean declared as session scope for my actions: action path=/admin/editClubInit type=admin.EditClubInit name=admin.editClubForm scope=session forward name=success path=/admin/editClub.do/ /action action path=/admin/editClub forward=admin.editClub / action path=/admin/editClubAction type=admin.EditClubAction name=admin.editClubForm scope=session forward name=failure path=/admin/editClub.do/ forward name=success path=/admin/showClubs.do redirect=true / /action The persistent.Feature class has a field text with setText and getText accessors. When want want to display the data, I first call /admin/editClubInit to populate the DynaForm. Here is the code that does that: Feature[] features = new Feature[NUM_FEATURES]; for( int i=0; iNUM_FEATURES; i++ ) { features[i] = new persistent.Feature(Test [+i+]); } df.set(features, features); After populating the form, the EditClubInit action forwards to user to the page to display the form. Here is the JSP code that shows the data: logic:iterate name=admin.editClubForm property=features id=feature br html:textarea name=feature property=text indexed=true rows=3 cols=75/ /logic:iterate The data appears correctly on the page. Unfortunately, when I submit the form to my action class to process it, I do not get the text I submitted. I get the original text that EditClubInit prepopulated the form with. Here is the code I am using to retrieve the data: Feature[] features = (Feature[]) df.get(features); for( int i=0; ifeatures.length; i++ ) { System.err.println( Feature[+i+] is +features[i].getText()); } Any ideas why this would not be working? If you need to see more details, I can provide them. I was trying to focus on what I thought would be helpful. Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Issue with logic:iterate
Hi All, Is there any way to break loop of logic:iterate loop based on a condition ? Thanks in advance, Anil.
RE: Issue with logic:iterate
% break; % From: sadineni [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: Issue with logic:iterate Date: Tue, 12 Jul 2005 20:30:42 +0530 Hi All, Is there any way to break loop of logic:iterate loop based on a condition ? Thanks in advance, Anil. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem accessing elements of Collection inside logic:iterate
Hello everyone, I need your help with a tricky problem, where I do not see any explanation currently: I try to construct a table with all data items stored in a database using Hibernate. There is a Form bean for the data items themselves and a form bean with a Collection (ArrayList) with the list of all such data items. Here is the relevant JSP code logic:present name=InterfacesOverviewForm logic:notEmpty name=InterfacesOverviewForm property=interfacesItems table logic:iterate id=InterfacesOverviewData name=InterfacesOverviewForm property=interfacesItems type=de.Platinion.rr.QuestGen.P200038_26.Presentation.form.InterfacesInputFo rm tr td html:text name=InterfacesOverviewData property=mainId size=2/ // put one property of the interfaces data item into the table cell (**) . . . /logic:notEmpty logic:empty name=InterfacesOverviewForm property=interfacesItems No Interfaces data items stored yet. br / /logic:empty /logic:present logic:notPresent name=InterfacesOverviewForm No Interfaces data items available. br / /logic:notPresent In my OverviewInterfacesAction I do the following: ... Collection lDTOList = lService.readData(); // read data from the persistence layer ArrayList lFormInterfacesList = new ArrayList(); // the list of form beans lFormInterfacesList = (ArrayList) convert(lDTOList); convert DTO's to form beans lForm.setInterfacesItems(lFormInterfacesList); // set the form bean collection into the form pRequest.setAttribute(InterfacesOverviewForm,lForm); // place the form with the collection into the request return (pMapping.findForward(Constants.SUCCESS)); // done } I expect that in my JSP, The iterate gets in each iteration one form after the other out of the collection and that I have access to the properties of the collection elements as in line (**) Unfortunately there are two effects that I cannot explain: 1) With the code as above I get an Exception stating, that bean InterfacesOverviewData cannot be found in any scope 2) If I start the JSP with a bean:define id=InterfacesOverviewData name=InterfacesOverviewForm type=de.Platinion.rr.QuestGen.P200038_26.Presentation.form.InterfacesOvervie wForm/ I still get a different exception, but this time stating, that there is no getter method for property mainId in form InterfacesOverviewForm, which is correct since that form contains a Collection with elements which all have a property mainId and getter getMainId(). 3) If I try to access the Collection instead of a property in line (**), i.e. I change the line to: html:text name=InterfacesOverviewData property=interfacesItems size=150/ Then I see the the ArrayList printed (I provided a toString() method in the InterfacesInputForm (i.e. the form which represents an element of the Collection), thoug obviously the Collection is there and can be accessed. 4) A further observation which I cannot explain might indicate that the heart of my error in not caused by the logic:iterate tag itself: both branches of the surrounding logic:present and logic:empty checks, i.e., logic:present and logic:notPresent and logic:empty and logic:notEmpty are executed (with the code as described until (3)) Any help or hint is highly appreciated! Thanks in advanced Robert Dr. Robert Riemann | IT Architect Platinion GmbH A Company of The Boston Consulting group Ridlerstr. 31b 80339 Munich/Germany Tel. +49 (0) 89 54545-53 22 Mobile +49 (0) 160 532 33 22 Fax +49 (0) 89 5108 2900 mailto:[EMAIL PROTECTED] http://www.platinion.de
Problem accessing elements of Collection inside logic:iterate (II)
Hello everyone, (a second post since my mail editor just made the posting unreadable... sorry!) I need your help with a tricky problem, where I do not see any explanation currently: I try to construct a table with all data items stored in a database using Hibernate. There is a Form bean for the data items themselves and a form bean with a Collection (ArrayList) with the list of all such data items. Here is the relevant JSP code ... logic:present name=InterfacesOverviewForm logic:notEmpty name=InterfacesOverviewForm property=interfacesItems table logic:iterate id=InterfacesOverviewData name=InterfacesOverviewForm property=interfacesItems type=Presentation.form.InterfacesInputForm tr td !-- put a property of the interfaces item in table cell -- html:text name=InterfacesOverviewData property=mainId size=2/ !-- (**) -- /logic:notEmpty logic:empty name=InterfacesOverviewForm property=interfacesItems No Interfaces data items stored yet. br / /logic:empty /logic:present logic:notPresent name=InterfacesOverviewForm No Interfaces data items available. br / /logic:notPresent In my OverviewInterfacesAction I do the following: ... // read data from the persistence layer Collection lDTOList = lService.readData(); // the list of form beans ArrayList lFormInterfacesList = new ArrayList(); // convert DTO's to form beans lFormInterfacesList = (ArrayList) convert(lDTOList); // set the form bean collection into the form lForm.setInterfacesItems(lFormInterfacesList); // place the form with the collection into the request pRequest.setAttribute(InterfacesOverviewForm,lForm); // done return (pMapping.findForward(Constants.SUCCESS)); } I would expect that in my JSP, The iterate gets in each iteration one form after the other out of the collection and that I have access to the properties of the collection elements as in line (**) Unfortunately there are two effects that I cannot explain: 1) With the code as above I get an Exception stating, that bean InterfacesOverviewData cannot be found in any scope 2) If I start the JSP with a bean:define id=InterfacesOverviewData name=InterfacesOverviewForm type=Presentation.form.InterfacesOverviewForm/ I still get a different exception, but this time stating, that there is no getter method for property mainId in form InterfacesOverviewForm, which is correct since that form contains a Collection with elements which all have a property mainId and getter getMainId(). 3) If I try to access the Collection instead of a property in line (**), i.e. I change the line to: html:text name=InterfacesOverviewData property=interfacesItems size=150/ Then I see the the ArrayList printed (I provided a toString() method in the InterfacesInputForm (i.e. the form which represents an element of the Collection), thoug obviously the Collection is there and can be accessed. 4) A further observation which I cannot explain might indicate that the heart of my error in not caused by the logic:iterate tag itself: both branches of the surrounding logic:present and logic:empty checks, i.e.,logic:present and logic:notPresent and logic:empty and logic:notEmpty are executed (with the code as described until (3)) Any help or hint is highly appreciated! Thanks in advanced Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem accessing elements of Collection inside logic:iterate (II)
Riemann Robert (Platinion) wrote: Hello everyone, (a second post since my mail editor just made the posting unreadable... sorry!) I need your help with a tricky problem, where I do not see any explanation currently: I try to construct a table with all data items stored in a database using Hibernate. There is a Form bean for the data items themselves and a form bean with a Collection (ArrayList) with the list of all such data items. Here is the relevant JSP code ... logic:present name=InterfacesOverviewForm logic:notEmpty name=InterfacesOverviewForm property=interfacesItems table logic:iterate id=InterfacesOverviewData name=InterfacesOverviewForm property=interfacesItems type=Presentation.form.InterfacesInputForm tr td !-- put a property of the interfaces item in table cell -- html:text name=InterfacesOverviewData property=mainId size=2/ !-- (**) -- /logic:notEmpty logic:empty name=InterfacesOverviewForm property=interfacesItems No Interfaces data items stored yet. br / /logic:empty /logic:present logic:notPresent name=InterfacesOverviewForm No Interfaces data items available. br / /logic:notPresent In my OverviewInterfacesAction I do the following: ... // read data from the persistence layer Collection lDTOList = lService.readData(); // the list of form beans ArrayList lFormInterfacesList = new ArrayList(); // convert DTO's to form beans lFormInterfacesList = (ArrayList) convert(lDTOList); // set the form bean collection into the form lForm.setInterfacesItems(lFormInterfacesList); // place the form with the collection into the request pRequest.setAttribute(InterfacesOverviewForm,lForm); // done return (pMapping.findForward(Constants.SUCCESS)); } I would expect that in my JSP, The iterate gets in each iteration one form after the other out of the collection and that I have access to the properties of the collection elements as in line (**) Unfortunately there are two effects that I cannot explain: 1) With the code as above I get an Exception stating, that bean InterfacesOverviewData cannot be found in any scope Maybe convert() is returning null? 2) If I start the JSP with a bean:define id=InterfacesOverviewData name=InterfacesOverviewForm type=Presentation.form.InterfacesOverviewForm/ I still get a different exception, but this time stating, that there is no getter method for property mainId in form InterfacesOverviewForm, which is correct since that form contains a Collection with elements which all have a property mainId and getter getMainId(). Yes, but your bean:define binds IngerfacesOverviewData to an instance of interfacesOverviewForm, not to the element type. 3) If I try to access the Collection instead of a property in line (**), i.e. I change the line to: html:text name=InterfacesOverviewData property=interfacesItems size=150/ Then I see the the ArrayList printed (I provided a toString() method in the InterfacesInputForm (i.e. the form which represents an element of the Collection), thoug obviously the Collection is there and can be accessed. With or without the bean:define? Shouldn't that be name=InterfacesOverviewForm? 4) A further observation which I cannot explain might indicate that the heart of my error in not caused by the logic:iterate tag itself: both branches of the surrounding logic:present and logic:empty checks, i.e.,logic:present and logic:notPresent and logic:empty and logic:notEmpty are executed (with the code as described until (3)) That sounds a bit odd... I'd suggest adding some debugging code to the JSP to print out everything in the various scopes to make sure everything's as you expect it. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:lessThan inside logic:iterate
Dear list, I've been fighting this problem for some time now, and can't come up with a solution. Please advice. In my jsp page I'm iterating an array of Category objects which resides in the request scope. This is done with the logic:iterate tag like this: logic:iterate id=categories name=category_array Each Category-object contains a Message-object field called lastmessage which in turn contains a timestamp-field (a long). In session-scope, there is a User object with a lastlogin field (a long). All objects have the appropriate getters (and setters) for all fields. Inside the iteration, I'm trying to do a comparison between the timestamp field of the Message object inside the Category object currently processed and the lastlogin field of the user object. This is how I'd like it to work: logic:iterate id=categories name=category_array logic:present name=user scope=session logic:lessThan name=user property=lastlogin value=category.lastmessage.timestamp //do something /logic:lessThan /logic:present /logic:iterate Now this doesn't work since the timestamp field is referenced wrongly. My next thought was to use logic-el taglib, but there's no lessThan tag in that library, because the jstl-c library is supposed to offer the same functionality. I tried jstl-c's c:if tag, but the problem is that I can't reference the iterating categories object, like this: c:if test=${user.lastlogin categories.lastmessage.timestamp} //do something /c:if This doesn't recognize the categories property. So then I'd have to use the c:iterate tag, but then again I have a bunch of bean:write/ and other el-tags inside the iteration as well, using the categories property created by the logic:iterate tag. These tags wouldn't work properly if using inside a c:iterate tag (i suppose). So, what should I do? How can I reference the timestamp-field in the Message-object inside the Category object in a lessThan tag inside an iteration? (phew) Thankful for any advice. Fredrik Bostrm The relevant code: table class=categorytable logic:iterate id=categories name=category_array tr th html:link action=/ShowThreads.do paramId=categoryId paramName=categories paramProperty=id bean:write name=categories property=name filter=false / /html:link logic:present name=user scope=session logic:lessThan !-- compare user.lastlogin to -- !-- category.lastmessage.timestamp -- New messages! /logic:lessThan /logic:present /th th class=categorycontrols logic:present name=user scope=session logic:equal name=user property=sumode value=true html-el:link action=/EditCategory.do?action=editcategoryId=${categories.id} Edit /html-el:link html-el:link action=/EditCategory.do?action=deletecategoryId=${categories.id} Delete /html-el:link /logic:equal /logic:present /th /tr tr td colspan=2 bean:write name=categories property=description filter=false/ /td /tr /logic:iterate /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with indexed property and logic:iterate
Just passing you a solution I had got from the user list earlier Nitesh - Original Message - From: John Fitzpatrick [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, June 03, 2005 6:06 PM Subject: Re: Problem using indexed properties and validator framework In the struts-config.xml: form-bean name=ManageAccountsForm type=application.EditUsersForm form-property name=users type=application.UserBean[] /form-bean action-mappings action path=/application/EditUsers type=application.EditUsersAction name=EditUsersForm scope=session forward name=success path=editUsers.jsp redirect=false / action-mappings In EditUsersAction.java execute method // get collection of users from the database Collection users = getUserBeans (); // put collection into form as an array for editing form.set ( users, users.toArray ( new UserBean[0] ) ); In editUsers.jsp logic:iterate id=users name=EditUsersForm property=users html:text name=users property=name indexed=true /logic:iterate In the produced HTML: input type=text name=users[0].name / If you need to client side validation, you'll probably need to write your own JSP to deal with the element above. As for using validate.xml to validate on the server side. I've never tried it with arrays, I just iterate over them in the validate (...) method of the form, like so: UserBean users[] = (UserBean[]) form.get ( users ); for ( int i = 0; i users.length; i++ ) { // check on the attributes of UserBean users[i] } Hope that example clears it up for you. John On 20050603 5:05 AM, Nitesh [EMAIL PROTECTED] wrote: Thanks for the answer John... Could you give me an example as to how we pre populate the array? Regards, Nitesh - Original Message - From: John Fitzpatrick [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 02, 2005 6:00 PM Subject: Re: Problem using indexed properties and validator framework For an Array in a DynaForm property, you can either set the size in the form-property descriptor or, in the case of a session form, pre-populate the Array in your action with the number of elements you desire. - 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: Problem with logic:iterate Tag
Any guess whats happening wrong here?, the output is as follows 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol But the correct output should be as follows 1stCol 2ndCol 3rdCol 4thCol 1stCol 2ndCol 3rdCol 4thCol Deepak -Original Message- From: Deepak Srivatava [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 6:57 PM To: user@struts.apache.org Subject: Problem with logic:iterate Tag I am populating following simple List in action class and putting that in form class. private List getSystemTableList(ConfWizardBean confwizbean, HttpSession session){ ArrayList outerList = new ArrayList(); for (int i = 0; i 2; i++) { ArrayList innerList = new ArrayList(); innerList.add(0,Ist Column); innerList.add(1,2nd Column); innerList.add(2,3rd column); innerList.add(3,4th Column); outerList.add(innerList); } return outerList; } relevant JSP code is as follows %-- Iterate through the system list --% bean:define id=systemList name=MyForm property=systemTableList/ logic:present name=systemList logic:notEmpty name=systemList logic:iterate id=innerList name=systemList indexId=index logic:iterate id=1stCol name=innerList offset=0/ logic:iterate id=2ndCol name=innerList offset=1/ logic:iterate id=3rdCol name=innerList offset=2/ logic:iterate id=4thCol name=innerList offset=3/ TD align=center class=bodyText nowrapbean:write name=1stCol //td TD align=center valign=middlebean:write name=2ndCol//td TD align=center valign=middlebean:write name=3rdCol //td TD align=center valign=middlebean:write name=4thCol//td /logic:iterate /logic:notEmpty /logic:present I am trying to print the above list in Jsp page but it always print the value 4th Column in all the four columns of HTML. Somehow it always uses the offset=3. What I am doing wrong here?. Deepak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate Tag
I am populating following simple List in action class and putting that in form class. private List getSystemTableList(ConfWizardBean confwizbean, HttpSession session){ ArrayList outerList = new ArrayList(); for (int i = 0; i 2; i++) { ArrayList innerList = new ArrayList(); innerList.add(0,Ist Column); innerList.add(1,2nd Column); innerList.add(2,3rd column); innerList.add(3,4th Column); outerList.add(innerList); } return outerList; } relevant JSP code is as follows %-- Iterate through the system list --% bean:define id=systemList name=MyForm property=systemTableList/ logic:present name=systemList logic:notEmpty name=systemList logic:iterate id=innerList name=systemList indexId=index logic:iterate id=1stCol name=innerList offset=0/ logic:iterate id=2ndCol name=innerList offset=1/ logic:iterate id=3rdCol name=innerList offset=2/ logic:iterate id=4thCol name=innerList offset=3/ TD align=center class=bodyText nowrapbean:write name=1stCol //td TD align=center valign=middlebean:write name=2ndCol//td TD align=center valign=middlebean:write name=3rdCol //td TD align=center valign=middlebean:write name=4thCol//td /logic:iterate /logic:notEmpty /logic:present I am trying to print the above list in Jsp page but it always print the value 4th Column in all the four columns of HTML. Somehow it always uses the offset=3. What I am doing wrong here?. Deepak
Message resource exception caused by bean:write inside logic:iterate
Hey all, I get an exception and cannot find any explanation or solution. An OverviewBody.jsp page intends to list all data items from a database. It therefore cretaes an appropriate table, the table body is implemented using a logic:iterate tag, the single table columns/cells are supposed to get populated using bean:write tags. Doing this leads to an exception [ERROR] InsertTag - ServletException in '/pages/OverviewBody.jsp': Cannot find message resources under key org.apache.struts.action.MESSAGE javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGEjavax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE when calling the appropriate action. However, all othe pages work fine with the specified ressource bundles. If I eliminate all bean:write tags in the page, the exception does not occur. I therefore assume that the exception does not really mean in my case that the system cannot access the resource bundles. Unfortunately, I have no other idea of how to solve the problem... Any idea or hint would help and is highly appreciated. Thanks Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate multiple collections
A related question, so I thought I'll post it to this thread. The data structure I use is a HashMap, whose values are other HashMaps. Like so: OuterMap OuterKey1: InnerMap1 InnerKey11: Value11 InnerKey12: Value12 OuterKey2: InnerMap2 InnerKey21: Value21 InnerKey22: Value22 I'm trying to nest two logic:iterate tags to print out the keys in the outer map and the values in the inner Map. What I'm trying to do is something like this: logic:iterate id=myOuterMap name=myForm property=myOuterMap tr tdbean:write name=myOuterMap property=key//td logic:iterate id=myInnerMap name=myForm property=myInnerMap tdbean:write name=myInnerMap property=value//td /logic:iterate /tr /logic:iterate This has a problem, because, it needs the innerMap attribute set in the request - however, this always gets the same value, probably because of the way I'm setting it in my Action. 1) I probably need a list of innerMaps in my form, but I'm not sure how to do this. 2) If I try to print the value using the outerMap alone, like so, tdbean:write name=MyOuterMap property=value//td I'm not sure how I can format this in the way that only the values are seen. Does anyone have any pointers? Thanks, PS -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, May 23, 2005 6:42 PM To: Struts Users Mailing List Subject: Re: logic:iterate multiple collections From: Titus Barik [EMAIL PROTECTED] Let's say I have two collections, A, and B. Is there a way to iterate over multiple collections with something like logic:iterate? If you know they're the same size and in the same order, (should be the case with List,) how about iterating over one with c:forEach varStatus=status and using ${status.count} to address the second List. Can you change the design? If the items in both collections really belong together, try to store them together so you don't have to jump through hoops like this. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate multiple collections
From: [EMAIL PROTECTED] The data structure I use is a HashMap, whose values are other HashMaps. I'm trying to nest two logic:iterate tags to print out the keys in the outer map and the values in the inner Map. c:forEach var=outerMapEntry items=${outerMap} c:out value=${outerMapEntry.key}/ c:forEach var=innerMapEntry items=${outerMapEntry.value} c:out value=${innerMapEntry.value}/ /c:forEach /c:forEach See http://wiki.wendysmoak.com/cgi-bin/wiki.pl?JSTLNestedMapIterate for test code. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate multiple collections
Thanks! That worked, and is also much easier to understand. This is probably a newbie question: How / when does one choose between using JSTL / Struts Tags? Is there any reason to choose Struts tags over JSTL? Thanks, PS -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 24, 2005 11:02 AM To: Struts Users Mailing List Subject: Re: logic:iterate multiple collections From: [EMAIL PROTECTED] The data structure I use is a HashMap, whose values are other HashMaps. I'm trying to nest two logic:iterate tags to print out the keys in the outer map and the values in the inner Map. c:forEach var=outerMapEntry items=${outerMap} c:out value=${outerMapEntry.key}/ c:forEach var=innerMapEntry items=${outerMapEntry.value} c:out value=${innerMapEntry.value}/ /c:forEach /c:forEach See http://wiki.wendysmoak.com/cgi-bin/wiki.pl?JSTLNestedMapIterate for test code. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate multiple collections
See http://struts.apache.org/faqs/struts-el.html. It includes a list of Struts tags whose functionality is covered by the JSTL. On 5/24/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks! That worked, and is also much easier to understand. This is probably a newbie question: How / when does one choose between using JSTL / Struts Tags? Is there any reason to choose Struts tags over JSTL? Thanks, PS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate multiple collections
Hi all, Let's say I have two collections, A, and B. Is there a way to iterate over multiple collections with something like logic:iterate? i.e logic:iterate ${rowA.name} ${rowB.value} /logic:iterate -- Titus Barik ([EMAIL PROTECTED]) http://www.barik.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate multiple collections
From: Titus Barik [EMAIL PROTECTED] Let's say I have two collections, A, and B. Is there a way to iterate over multiple collections with something like logic:iterate? If you know they're the same size and in the same order, (should be the case with List,) how about iterating over one with c:forEach varStatus=status and using ${status.count} to address the second List. Can you change the design? If the items in both collections really belong together, try to store them together so you don't have to jump through hoops like this. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate and LazyValidatorForm
I'm trying to iterate over a String[] in a LazyValidatorForm using: logic:iterate name=myForm property=first ... But I get the following error: Unable to find a value for first in object of class org.apache.struts.validator.LazyValidatorForm using operator . So, does the logic:iterate tag work with DynaBeans? From the source code, it uses BeanUtils.getProperty(), which works with DynaBeans. Any ideas? Thanks. - Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate and LazyValidatorForm
So, does the logic:iterate tag work with DynaBeans? From the source code, it uses BeanUtils.getProperty(), which works with DynaBeans. Any ideas? Thanks. Please disregard this post. The problem was actually later on when I attempted to access the DynaBean via JSTL, which doesn't work for obvious reasons. - Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate and LazyValidatorForm
From: Durham David R Jr Ctr 805 CSPTS/SCE [EMAIL PROTECTED] The problem was actually later on when I attempted to access the DynaBean via JSTL, which doesn't work for obvious reasons. LazyValidatorForm has a 'getMap' method, so you _can_ use it with JSTL. I use LazyDynaBean, which has the same method. Example: c:out value=${someDynaBean.map.lastName}/ -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamically generating parameterized links using logic:iterate
First of all, I know this must be a frequently asked question. In java server pages, I would do this: % while someiterator.hasNext(){ % a href=/somepage?param1=%=String strVal=(String)someiterator.next()%Go/abr / % } This seems fairly strait forward. Using the struts framework and tags, I am struggling. logic:iterate id=result name=ParcelSearchForm property=results html:link page=/somepage.do name=result scope=page paramId=parcel bean:write name=result property=parcel//html:linkbr / /logic:iterate I am not sure what I need to use in order to grab the parcel value from the form bean. I know my syntax is wrong. Can someone please demonstrate the proper way to do this. Randall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically generating parameterized links using logic:iterate
I guess, it would something like this: logic:iterate id=result name=ParcelSearchForm property=results type=com.acme.ParcelObj html:link page=/somepage.do paramId=param1 paramName=result paramProperty=parcel bean:write name=result property=parcel/ /html:link /logic:iterate where com.acme.ParcelObj is the object type, which is collected within results and which has parcel property. Michael. On 4/27/05, Randall Svancara [EMAIL PROTECTED] wrote: First of all, I know this must be a frequently asked question. In java server pages, I would do this: % while someiterator.hasNext(){ % a href=/somepage?param1=%=String strVal=(String)someiterator.next()%Go/abr / % } This seems fairly strait forward. Using the struts framework and tags, I am struggling. logic:iterate id=result name=ParcelSearchForm property=results html:link page=/somepage.do name=result scope=page paramId=parcel bean:write name=result property=parcel//html:linkbr / /logic:iterate I am not sure what I need to use in order to grab the parcel value from the form bean. I know my syntax is wrong. Can someone please demonstrate the proper way to do this. Randall - 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: Dynamically generating parameterized links using logic:iterate
Thanks, That worked. I need to read the documentation!!! -Original Message- From: Michael Jouravlev [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 27, 2005 12:21 PM To: Struts Users Mailing List Subject: Re: Dynamically generating parameterized links using logic:iterate I guess, it would something like this: logic:iterate id=result name=ParcelSearchForm property=results type=com.acme.ParcelObj html:link page=/somepage.do paramId=param1 paramName=result paramProperty=parcel bean:write name=result property=parcel/ /html:link /logic:iterate where com.acme.ParcelObj is the object type, which is collected within results and which has parcel property. Michael. On 4/27/05, Randall Svancara [EMAIL PROTECTED] wrote: First of all, I know this must be a frequently asked question. In java server pages, I would do this: % while someiterator.hasNext(){ % a href=/somepage?param1=%=String strVal=(String)someiterator.next()%Go/abr / % } This seems fairly strait forward. Using the struts framework and tags, I am struggling. logic:iterate id=result name=ParcelSearchForm property=results html:link page=/somepage.do name=result scope=page paramId=parcel bean:write name=result property=parcel//html:linkbr / /logic:iterate I am not sure what I need to use in order to grab the parcel value from the form bean. I know my syntax is wrong. Can someone please demonstrate the proper way to do this. Randall - 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: problem with logic:iterate
Hi, U can do - logic:iterate collection=%= vec% id=vecRow indexId=index logic:equal ... //do some thing /logic:equal /logic:iterate --- Kade Jeevan Kumar [EMAIL PROTECTED] wrote: Hi i have for(int i=0; i vec.size(); i++) { if(i=5) { // do some thing } } how can i use the same code in logice:iterate Help me out with example. -Thnx in Advance Jeevan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate problem...
Hi all... I get this exception trying to render options with logic iterate tag... javax.servlet.jsp.JspException: Cannot create iterator for this collection My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. logic:iterate id=modulo collection='%=Globales.AreaPersonal.MODULOS_KEY%' option value='%=((Contenible)modulo).getId()%' %=((Contenible)modulo).getNombre()+ - + ((Contenible)modulo).getTitulo()% /option /logic:iterate i wish someone help me... thanks! Lucas __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Re: logic:iterate problem...
I think your List reference is probably null. Also, have you looked at html:options and html:optionsCollection? Erik Lucas Bern wrote: Hi all... I get this exception trying to render options with logic iterate tag... javax.servlet.jsp.JspException: Cannot create iterator for this collection My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. logic:iterate id=modulo collection='%=Globales.AreaPersonal.MODULOS_KEY%' option value='%=((Contenible)modulo).getId()%' %=((Contenible)modulo).getNombre()+ - + ((Contenible)modulo).getTitulo()% /option /logic:iterate i wish someone help me... thanks! Lucas __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate problem...
I would like to get a null pointer exception or a can not set bean to null when my list is null... I use to solve this kind of problem with html:options and html:optionsCollection but what i have to do in this page is very complex for this tags... thanks for your answer Erik Lucas Erik Weber [EMAIL PROTECTED] wrote: I think your List reference is probably null. Also, have you looked at html:options and html:optionsCollection? Erik Lucas Bern wrote: Hi all... I get this exception trying to render options with logic iterate tag... javax.servlet.jsp.JspException: Cannot create iterator for this collection My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. i wish someone help me... thanks! Lucas __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 250MB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo Abrí tu cuenta aquí
Re: logic:iterate problem...
Hmm I didn't even notice that. However, this is the section of code that throws that Exception (from 1.2.4 src): /** * Construct an iterator for the specified collection, and begin * looping through the body once per element. * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Acquire the collection we are going to iterate over Object collection = this.collection; if (collection == null) { collection = TagUtils.getInstance().lookup(pageContext, name, property, scope); } if (collection == null) { JspException e = new JspException(messages.getMessage(iterate.collection)); TagUtils.getInstance().saveException(pageContext, e); throw e; } So I'm not sure. Erik Michael Jouravlev wrote: Looks like you are trying to iterate over string. How about this: logic:iterate id=modulo collection='%=(List) session.getAttribute(Globales.AreaPersonal.MODULOS_KEY)%' Michael. On 4/21/05, Lucas Bern [EMAIL PROTECTED] wrote: Hi all... I get this exception trying to render options with logic iterate tag... javax.servlet.jsp.JspException: Cannot create iterator for this collection My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. logic:iterate id=modulo collection='%=Globales.AreaPersonal.MODULOS_KEY%' option value='%=((Contenible)modulo).getId()%' %=((Contenible)modulo).getNombre()+ - + ((Contenible)modulo).getTitulo()% /option /logic:iterate i wish someone help me... thanks! Lucas __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar - 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: logic:iterate problem...
From http://struts.apache.org/userGuide/struts-logic.html#iterate: collection: A runtime expression that evaluates to a collection %=Globales.AreaPersonal.MODULOS_KEY% probably evaluates to a String. What you need is name='%=Globales.AreaPersonal.MODULOS_KEY%' On 4/21/05, Lucas Bern [EMAIL PROTECTED] wrote: My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. logic:iterate id=modulo collection='%=Globales.AreaPersonal.MODULOS_KEY%' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate problem...
Great! it works fine... thanks Jeff and Erik. Lucas Jeff Beal [EMAIL PROTECTED] wrote: From http://struts.apache.org/userGuide/struts-logic.html#iterate: collection: A runtime expression that evaluates to a collection probably evaluates to a String. What you need is name='' On 4/21/05, Lucas Bern wrote: My action just get a List form a Srevice layer and store it in session scope under Globales.AreaPersonal.MODULOS_KEY. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 250MB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo Abrí tu cuenta aquí
problem with logic:iterate
Hi i have for(int i=0; i vec.size(); i++) { if(i=5) { // do some thing } } how can i use the same code in logice:iterate Help me out with example. -Thnx in Advance Jeevan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
logic:iterate, with offset and length parameters, lose data
Hi, I am using a logic:iterate tag throw a Collection. This collection is a property of my ActionForm. I set also an offset and length. So, shown elements work fine, but not shown elements are just null. I would not like to lose data of the not shown elements of the collection. I dont know how to use html:hidden for my purposes, because I think this only can be used for a property. Any help? Thanks in advance Oscar Cristobal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate, with offset and length parameters, lose data
Suggestions: 1- Use c:forEach instead of logic:iterate 2- Use a seperate property in your form to store the viewable/changeable stuff, for example if you have a collection of strings, you can have an array of strings be your viewable/editable property. This will cut down on network traffic and make debugging much easier. Otherwise you can do it as you mentioned with hidden fields: c:forEach items=formName.collectionProperty var=item varStatus=s c:if test=${s.index = offset and s.index offset + length} var=displayable html:input property=collectionProperty value=${item} / /c:if c:if test=${not displayable}html:hidden property=collectionProperty value=${item} //c:if /c:forEach Regards, Abdullah -Original Message- From: Oscar [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 20, 2005 5:23 AM To: user@struts.apache.org Subject: logic:iterate, with offset and length parameters, lose data Hi, I am using a logic:iterate tag throw a Collection. This collection is a property of my ActionForm. I set also an offset and length. So, shown elements work fine, but not shown elements are just null. I would not like to lose data of the not shown elements of the collection. I dont know how to use html:hidden for my purposes, because I think this only can be used for a property. Any help? Thanks in advance Oscar Cristobal - 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: logic:iterate, with offset and length parameters, lose data
that html:input is a mistake, it should be html:text -Original Message- From: Oscar [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 20, 2005 5:23 AM To: user@struts.apache.org Subject: logic:iterate, with offset and length parameters, lose data Hi, I am using a logic:iterate tag throw a Collection. This collection is a property of my ActionForm. I set also an offset and length. So, shown elements work fine, but not shown elements are just null. I would not like to lose data of the not shown elements of the collection. I dont know how to use html:hidden for my purposes, because I think this only can be used for a property. Any help? Thanks in advance Oscar Cristobal - 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: logic:iterate, with offset and length parameters, lose data
Also, the items attribute should be enclosed in ${} as: c:forEach items=${formName.collectionProperty} var=item varStatus=s c:if test=${s.index = offset and s.index offset + length} var=displayable html:text property=collectionProperty value=${item} / /c:if c:if test=${not displayable}html:hidden property=collectionProperty value=${item} //c:if /c:forEach -Original Message- From: Oscar [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 20, 2005 5:23 AM To: user@struts.apache.org Subject: logic:iterate, with offset and length parameters, lose data Hi, I am using a logic:iterate tag throw a Collection. This collection is a property of my ActionForm. I set also an offset and length. So, shown elements work fine, but not shown elements are just null. I would not like to lose data of the not shown elements of the collection. I dont know how to use html:hidden for my purposes, because I think this only can be used for a property. Any help? Thanks in advance Oscar Cristobal - 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]
logic:iterate and field indices
Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: logic:iterate and field indices
indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select You may also want to look at html:options and html:optionsCollection This would make above code a two-liner, and work with action forms. Regards Leon -Ursprüngliche Nachricht- Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Andre Bonhote Gesendet: Mittwoch, 6. April 2005 13:21 An: user@struts.apache.org Betreff: logic:iterate and field indices Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - 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]
AW: logic:iterate and field indices
indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select You may also want to look at html:options and html:optionsCollection This would make above code a two-liner, and work with action forms. Regards Leon -Ursprüngliche Nachricht- Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Andre Bonhote Gesendet: Mittwoch, 6. April 2005 13:21 An: user@struts.apache.org Betreff: logic:iterate and field indices Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - 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: AW: logic:iterate and field indices
Hi Leon Leon Rosenberg wrote: indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate Been there, but somehow didn't get what it was about ... closer now. select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select Yeehaa! Thanks a lot! You may also want to look at html:options and html:optionsCollection Will do that. This would make above code a two-liner, and work with action forms. Hm ... Could you describe the latter? I am using a form bean specified in struts-config.xml and that works perfectly for other fields (like html:text). Is there something wrong with it? Cheers André - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I look for an example of LOGIC:ITERATE that iterates over an ARRAY
Thank you Günther, for your help: Now it works fine! Jan-Jaap Günther Wieser wrote: i think the example in the docs shows you almost everything: logic:iterate id=element name=myhashtable Next element is bean:write name=element property=value/ /logic:iterate all you need to do is drop the property attribute as an array doesn't have properties. then it should work fine. so this is an array version: logic:iterate id=element name=myArray Next element in array is bean:write name=element / /logic:iterate kr, guenther -- Günther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien Austria http://www.creative-it.com -Original Message- From: Jan-Jaap Endenburg - Vera [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 1:50 PM To: Struts Users Mailing List Subject: I look for an example of LOGIC:ITERATE that iterates over an ARRAY Hi everyone, I look for an example of logic:iterate that iterates over an array (of strings): I am not sure how to display these array-values in my jsp-page: should this be done with bean:write? If so: what should I fill for name property? Thanks for your help! Jan-Jaap - 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]
logic:iterate Question
Folks, Thanks in advance for answering this urgent question. I know it's basic, but I'm stumped...your help is appreciated. I am trying to update data displayed via a logic:iterate tag with nested logic:equal tags: logic:iterate id=bean name=assetReportForm property=report.entries scope=session type=package.name.AssetReportEntryValue logic:equal name=bean property=level.name value=Level 1 logic:equal name=bean property=classification.name value=Unclassified tdhtml:text name=bean property=numCorrected indexed=true size=5//td /logic:equal /logic:equal /logic:iterate Whenever I submit the updated form, I expect the 'report.entries[x].numCorrected' bean property to be updated. Instead, the original property value is maintained. I tried setting the bean name to assetReportForm.report, but got the infamous Cannot find bean in any scope error. Any help is appreciated. Thanks, Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
nested arraylist on nested logic:iterate help
Hello Guys, Please help. I need to access an arraylist property inside the arraylist that I have just iterated over. I got this code . logic:iterate name=%= Konstants.SESSION_USER_KEY % property=originatingHosts id=ohosts tr td class=columnHeaderOriginating Hosts : /td td class=valuesbean:write name=ohosts property=hostname//td /tr tr td class=columnHeaderExchanges : /td td class=values /td /tr /logic:iterate Please note that originatingHosts is an arraylist. Now this has a property of exchanges which is also an arraylist. I need to display the desc property of every exchange object in this exchanges arraylist. Thanks in advance. Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with logic:iterate
hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar bean:write name=element/ /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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: Resolved problem with logic:iterate
Ok it's a trivial mistake, didn't actually put anything in the Vector. --- Jonathan M Z [EMAIL PROTECTED] wrote: hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar bean:write name=element/ /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
Is bar in the session? [EMAIL PROTECTED] 3/2/2005 12:45:03 PM thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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: problem with logic:iterate
pageContext.setAttribute(bar,projects,PageContext.PAGE_SCOPE); it's an attribute in the page scope, not session, does it have to be in a session? I am only using it for the current page... --- Eric Lemle [EMAIL PROTECTED] wrote: Is bar in the session? [EMAIL PROTECTED] 3/2/2005 12:45:03 PM thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pass logic:iterate bean into tile problem?
I have been trying to do the following in my layout with out success. tiles:importAttribute/ html:xhtml/ logic:iterate id=shipment name=pipePurchaseOrderForm property=pipePurchaseOrderValue.shipments indexId=row tiles:insert attribute=shipment/ /logic:iterate But I am forced to use jsp:directive.include file because I cannot get importAttribute and useAttribute set up correctly. How can pass the shipment bean to the page fragment by using tiles and not the jsp:directive :include? tiles:importAttribute/ html:xhtml/ logic:iterate id=shipment name=pipePurchaseOrderForm property=pipePurchaseOrderValue.shipments indexId=row jsp:directive.include file=shipmentData.jsp/ /logic:iterate Thank you for your time, Jason Long CEO and Chief Software Engineer Supernova Software BS Physics, MS Chemical Engineering
Pass logic:iterate bean into tile problem?
I have been trying to do the following in my layout with out success. tiles:importAttribute/ html:xhtml/ logic:iterate id=shipment name=pipePurchaseOrderForm property=pipePurchaseOrderValue.shipments indexId=row tiles:insert attribute=shipment/ /logic:iterate But I am forced to use jsp:directive.include file because I cannot get importAttribute and useAttribute set up correctly. How can pass the shipment bean to the page fragment by using tiles and not the jsp:directive :include? tiles:importAttribute/ html:xhtml/ logic:iterate id=shipment name=pipePurchaseOrderForm property=pipePurchaseOrderValue.shipments indexId=row jsp:directive.include file=shipmentData.jsp/ /logic:iterate Thank you for your time, Jason Long CEO and Chief Software Engineer Supernova Software BS Physics, MS Chemical Engineering
Re: Pass logic:iterate bean into tile problem?
tiles:insert attribute=shipment/ Are you trying to pass shipment object (which comes from the logic:iterate) to the tile page (through insert) ? If so try, tiles:insert definition=abc put name=shipment value=%=shipment%/ /tiles:insert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error with logic:iterate on dynabeans
After going thru some source codes in the struts package, i discovered that the problem hat to do with formating, the last two colums of my table are DATE formats which translated to java.sql.date type in java. the bean taglib was looking for a resource ot determine how to format the data on those fields but since i did not create any resource configurations, it was looking for what was not there. i had to hard code a format on the bean:write tag using the format attribute. i dont think this is a neat idea especially for beginers like me who want to whip up a working application with as little advanced configurations as possible so we can learn one thing at a time, (resource bundles/intenationalizatin, jdbc, etc) and still get struts to give us some workable defaults. - Original Message - From: Olasoji Ajayi [EMAIL PROTECTED] To: struts user mailing list user@struts.apache.org Sent: Tuesday, January 04, 2005 9:18 AM Subject: error with logic:iterate on dynabeans i get the following error when i run a web application to display the contents of a table. HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800) org.apache.jsp.formFile_jsp._jspService(formFile_jsp.java:238) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305)root causejavax.servlet.jsp.JspException: Cannot find message resources under keyorg.apache.struts.action.MESSAGE org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1233) org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082) org.apache.struts.taglib.TagUtils.message(TagUtils.java:1057) org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:256) org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:362) org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:234) org.apache.jsp.formFile_jsp._jspService(formFile_jsp.java:195) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158
error with logic:iterate on dynabeans
is available in the Tomcat logs. Apache Tomcat/5.0.19 below is the code i want to use to display the content of a database table. the rowSet attribute is a RowSetDynaClass containing the result of the query. bean:define id=cols name=rowSet property=dynaProperties/ table border=2 tr logic:iterate id=col name=cols thbean:write name=col property=name//th /logic:iterate /tr logic:iterate id=row name=rowSet property=rows tr logic:iterate id=col name=cols td bean:write name=row property=%= ((DynaProperty)col).getName() %/ /td /logic:iterate /tr /logic:iterate /table when i replace the %= ((DynaProperty)col).getName()% with one of the values of the column, the program runs correctly (i.e. the entire table is populated with the values of the column as expected). why is it not working and if it can't what other method can i use to dynamicaly generate the property value for the tag
Re: How to use logic:iterate with DynaValidatorForm
Struts has built in support for DynaBeans. logic:iterate id=account name=editBUForm property=account ... /logic:iterate /robert --- [EMAIL PROTECTED] wrote: - struts-config.xml form-beans form-bean name=editBUForm type=org.apache.struts.validator.DynaValidatorForm form-property name=account type=com.psca.M28000.bo.Account[]/ /form-bean /form-beans action-mappings action name=editBUForm path=/EditBUOnLoadAction scope=session type=com.psca.M28000.action.EditBUOnLoadAction validate=false forward name=ok path=/frmEditBU.jsp/ /action action name=editBUForm path=/EditBUOnSubmitAction input=/frmEditBU.jsp scope=session type=com.psca.M28000.action.EditBUOnSubmitAction validate=true/ /action-mappings - EditBUOnLoadAction.java DynaValidatorForm df = (DynaValidatorForm) form; Set acc = bu.getAccounts(); Account[] account = new Account[acc.size()]; int i = 0; for(Iterator ite = acc.iterator(); ite.hasNext(); i++) { account[i] = (Account)ite.next(); } df.set(account, account); - jsp page logic:iterate id=account name=editBUForm.map.Account tr td align=center style=border-left:1px #8FA8CC solid bean:write name=account property=accCode scope=page/ /td td style=border-left:1px #8FA8CC solid; padding-left:2px bean:write name=account property=createdDt scope=page/ /td /tr /logic:iterate When I run the jsp page, I receive error Cannot find bean editBUForm.map.Account in any scope Could you show me how to use logic:iterate to loop through Account[] of form. I saw an example using standard taglib to do that html:form action=/processActorComments table border=1 width=80% trthLast Name/ththFirst Name/ththDate of Birth/ththComment/th/tr c:forEach var=people items=${dynamicArrayForm.map.people} trtdc:out value=${people.lastName}//td tdc:out value=${people.firstName}//td tdc:out value=${people.dateOfBirth}//td tdhtml:text name=people indexed=true property=comment//td /tr /c:forEach /table P/ html:submit value=Update Comments/ /html:form But I am using servlet 2.2, so that I cannot use standard taglib. Any help is much appreciated. Regards, Dang Minh Phuong - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Dress up your holiday email, Hollywood style. Learn more. http://celebrity.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate and HashMap
Hello all, I have a problem with the logic:iterate tag. I need to iterate over a HashMap which stores wrapper objects(which include the actual data). A wrapper class has for example one attribute velocity. As far as I know the only way to access such a HashMap is this method: logic:iterate id=element name=hashMap indexId=index bean:write name=element property=key / bean:write name=element property=value / /logic:iterate Is there any way to get the velocity attribute out of the wrapper class? Regards, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate and HashMap
logic:iterate id=element name=hashMap indexId=index bean:define id = vObj name=element property=value / bean:write name = vObj property = velocity / /logic:iterate Peter Neu wrote: Hello all, I have a problem with the logic:iterate tag. I need to iterate over a HashMap which stores wrapper objects(which include the actual data). A wrapper class has for example one attribute velocity. As far as I know the only way to access such a HashMap is this method: logic:iterate id=element name=hashMap indexId=index bean:write name=element property=key / bean:write name=element property=value / /logic:iterate Is there any way to get the velocity attribute out of the wrapper class? Regards, Peter - 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]
How to use logic:iterate with DynaValidatorForm
- struts-config.xml form-beans form-bean name=editBUForm type=org.apache.struts.validator.DynaValidatorForm form-property name=account type=com.psca.M28000.bo.Account[]/ /form-bean /form-beans action-mappings action name=editBUForm path=/EditBUOnLoadAction scope=session type=com.psca.M28000.action.EditBUOnLoadAction validate=false forward name=ok path=/frmEditBU.jsp/ /action action name=editBUForm path=/EditBUOnSubmitAction input=/frmEditBU.jsp scope=session type=com.psca.M28000.action.EditBUOnSubmitAction validate=true/ /action-mappings - EditBUOnLoadAction.java DynaValidatorForm df = (DynaValidatorForm) form; Set acc = bu.getAccounts(); Account[] account = new Account[acc.size()]; int i = 0; for(Iterator ite = acc.iterator(); ite.hasNext(); i++) { account[i] = (Account)ite.next(); } df.set(account, account); - jsp page logic:iterate id=account name=editBUForm.map.Account tr td align=center style=border-left:1px #8FA8CC solid bean:write name=account property=accCode scope=page/ /td td style=border-left:1px #8FA8CC solid; padding-left:2px bean:write name=account property=createdDt scope=page/ /td /tr /logic:iterate When I run the jsp page, I receive error Cannot find bean editBUForm.map.Account in any scope Could you show me how to use logic:iterate to loop through Account[] of form. I saw an example using standard taglib to do that html:form action=/processActorComments table border=1 width=80% trthLast Name/ththFirst Name/ththDate of Birth/ththComment/th/tr c:forEach var=people items=${dynamicArrayForm.map.people} trtdc:out value=${people.lastName}//td tdc:out value=${people.firstName}//td tdc:out value=${people.dateOfBirth}//td tdhtml:text name=people indexed=true property=comment//td /tr /c:forEach /table P/ html:submit value=Update Comments/ /html:form But I am using servlet 2.2, so that I cannot use standard taglib. Any help is much appreciated. Regards, Dang Minh Phuong - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help : creating dynamic styleId inside Logic:iterate
It is not allowed to have just part of attribute value as JSP expression. Here is the correct solution: html:text name=iType styleId=%=sp + iterator% property=sharesPer/ Peace, Aidas sachin [EMAIL PROTECTED] wrote: I have a jsp page in which i have a loop and a text field inside it. Now to create a dynamic styleid i have used the following code.. but when this code executes , it does not print the actual value of itrator . It should give styleId=sp0 , styleId=sp1 , styleId=sp2 likewise .. but it prints simply ' styleId=sp% = itrator % ' for all the fields . can someone provide a solution to create dynamic styleId ... ? % int itrator=0; % logic:iterate id=iType property=investorTypeList name=sharePatternBean html:text name=iType styleId=sp% = itrator % property=sharesPer readonly=true / %itrator++;% /logic:iterate Regards, Sachin Hegde, Software Developer, Paradyne Infotech Limited, Mumbai 022-38546711 - 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: Help : creating dynamic styleId inside Logic:iterate
On Monday 29 November 2004 14:27, Aidas Semezys wrote: It is not allowed to have just part of attribute value as JSP expression. Here is the correct solution: html:text name=iType styleId=%=sp + iterator% property=sharesPer/ Thanks! That solved a problem I was about to ask ... -- derek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help : creating dynamic styleId inside Logic:iterate
I have a jsp page in which i have a loop and a text field inside it. Now to create a dynamic styleid i have used the following code.. but when this code executes , it does not print the actual value of itrator . It should give styleId=sp0 , styleId=sp1 , styleId=sp2 likewise .. but it prints simply ' styleId=sp% = itrator % ' for all the fields . can someone provide a solution to create dynamic styleId ... ? % int itrator=0; % logic:iterate id=iType property=investorTypeList name=sharePatternBean html:text name=iType styleId=sp% = itrator % property=sharesPer readonly=true / %itrator++;% /logic:iterate Regards, Sachin Hegde, Software Developer, Paradyne Infotech Limited, Mumbai 022-38546711 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate with DynaValidatorForm in Struts1.1
Hi, I am unable to iterate an ArrayList while using struts1.1 with DynaValidatorForm. Has any one tried it? I am getting the following error in WSAD 5.1... [04/11/17 14:31:41:915 IST] 54f64cef WebGroup E SRVE0026E: [Servlet Error]-[Cannot find bean ProductLines in any scope]: javax.servlet.jsp.JspException: Cannot find bean ProductLines in any scope Note: I have seen some examples using Form Bean classes but here I don't have any Form Bean since its a DynaValidatorForm thanks in advance. -selva. ___ Win a castle for NYE with your mates and Yahoo! Messenger http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tooltip with logic:iterate tag
Hi, I have a table in my application that I display through the logic:iterate Struts tag, One of the column contents a long text, I would like to add a 'Tooltip' in order to view the whole text, is it possible ? Thanks a lot in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text in logic:iterate
Hi, What I understood was like this: You have a logic:iterate tag Inside that you have the text field tag. Corresponding to the Logic:iterate you must be having a for loop inside the form population method in your action. There you will be populating the value from the said bean (in the bean you will be having list I suppose, from which you extract the corresponding entry to display in the logic:iterate) to the corresponding form field in the form bean. I also had the same problem sometime back. I did the way I suggested and it worked. That's why I suggested this way. Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate How do I populate it in the Action if I need to iterate through the ActionForms in my JSP? I am thinking that it is just an issue of getting around the parser. In other instance I have, just adding quotes here and there to 'fool' the parser solves my problems. e.g. I can have a bean:write tag inside a hidden tag.. Sebastian On Thu, 2004-11-04 at 15:09, Girish Kumar K. P. wrote: Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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: html:text in logic:iterate
Hi Thanks all for the suggestion. This way works and I am going with it. input type=text value=bean:write name=mymobilephaseloadings property=percentage/ size=10 name=percentage/ Sebastian On Thu, 2004-11-04 at 16:37, Girish Kumar K. P. wrote: Hi, What I understood was like this: You have a logic:iterate tag Inside that you have the text field tag. Corresponding to the Logic:iterate you must be having a for loop inside the form population method in your action. There you will be populating the value from the said bean (in the bean you will be having list I suppose, from which you extract the corresponding entry to display in the logic:iterate) to the corresponding form field in the form bean. I also had the same problem sometime back. I did the way I suggested and it worked. That's why I suggested this way. Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate How do I populate it in the Action if I need to iterate through the ActionForms in my JSP? I am thinking that it is just an issue of getting around the parser. In other instance I have, just adding quotes here and there to 'fool' the parser solves my problems. e.g. I can have a bean:write tag inside a hidden tag.. Sebastian On Thu, 2004-11-04 at 15:09, Girish Kumar K. P. wrote: Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how do I count array in logic:iterate
Hi, I've an array list called fruits. And, I want to count the number of fruit. How can I do it to write out the number? logic:iterate id=fruit name=fruits indexId=index %=index% /logic:iterate Thanks. --MM CONFIDENTIALITY NOTICE: The information in this e-mail is privileged and confidential. Any use, copying or dissemination of any portion of this e-mail by or to anyone other than the intended recipient(s) is unauthorized. If you have received this e-mail in error, please reply to sender and delete it from your system immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I count array in logic:iterate
bean:size id=numFruits name=fruits/ Number of fruits: bean:write name=numFruits/ -Bill Siggelkow Peng, Meimin wrote: Hi, I've an array list called fruits. And, I want to count the number of fruit. How can I do it to write out the number? logic:iterate id=fruit name=fruits indexId=index %=index% /logic:iterate Thanks. --MM CONFIDENTIALITY NOTICE: The information in this e-mail is privileged and confidential. Any use, copying or dissemination of any portion of this e-mail by or to anyone other than the intended recipient(s) is unauthorized. If you have received this e-mail in error, please reply to sender and delete it from your system immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do I count array in logic:iterate
I miss this tag. Thanks. --MM -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Bill Siggelkow Sent: Wednesday, November 03, 2004 3:45 PM To: [EMAIL PROTECTED] Subject: Re: how do I count array in logic:iterate bean:size id=numFruits name=fruits/ Number of fruits: bean:write name=numFruits/ -Bill Siggelkow Peng, Meimin wrote: Hi, I've an array list called fruits. And, I want to count the number of fruit. How can I do it to write out the number? logic:iterate id=fruit name=fruits indexId=index %=index% /logic:iterate Thanks. --MM CONFIDENTIALITY NOTICE: The information in this e-mail is privileged and confidential. Any use, copying or dissemination of any portion of this e-mail by or to anyone other than the intended recipient(s) is unauthorized. If you have received this e-mail in error, please reply to sender and delete it from your system immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: The information in this e-mail is privileged and confidential. Any use, copying or dissemination of any portion of this e-mail by or to anyone other than the intended recipient(s) is unauthorized. If you have received this e-mail in error, please reply to sender and delete it from your system immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:text in logic:iterate
Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text in logic:iterate
U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:text in logic:iterate
The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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: html:text in logic:iterate
Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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: html:text in logic:iterate
How do I populate it in the Action if I need to iterate through the ActionForms in my JSP? I am thinking that it is just an issue of getting around the parser. In other instance I have, just adding quotes here and there to 'fool' the parser solves my problems. e.g. I can have a bean:write tag inside a hidden tag.. Sebastian On Thu, 2004-11-04 at 15:09, Girish Kumar K. P. wrote: Anyway , the value if u give the value attribute, the values populated into the form bean from the action will not be displayed. Text field will diplay bean:write name=mymobilephaseloadings property=percentage/ So, poipulate the form bean at the action . That's it Dopn't give the value attribute. It will work -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:34 PM To: Struts Users Mailing List Subject: RE: html:text in logic:iterate The user is actually editing some data that is already saved. So I need the data to be displayed in the textbox (form). sebastian On Thu, 2004-11-04 at 14:52, Girish Kumar K. P. wrote: U shouldn't give the value attribute there. The value would be read from the form Regards, Girish -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 12:18 PM To: Struts Users Mailing List Subject: html:text in logic:iterate Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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: html:text in logic:iterate
Couldn't you just use one of the expression languages? For example: html:text property=percentage size=10 value=${mymobilephaseloadings.percentage}/ . . . in a JSP 2.0 (Expression Language-aware) container, or, using the EL tags: html-el:text property=percentage size=10 value=${mymobilephaseloadings.percentage}/ or %= mymobilephaseloadings.getPercentage() % using the older runtime expression language. Not sure if my syntax is 100% correct. Also, I think you might be able to embed the c:out tag in place of the bean:write tag. Make sure you really want to use the value attribute, as this can have undesired consequences when paired with an ActionForm. Erik Sebastian Ho wrote: Hi I have a iterate tag which contains a text box. I wish to display value in the textbox. But this line in the JSP couldnt get through the parsing. html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// Anyone knoww how to get around this? Thanks Sebastian Ho - logic:iterate id=mymobilephaseloadings name=mobilephaseloadings scope=session tr bgcolor=#CC html:form action=EditLCMSMSGradientStepByIdentifier.do td bean:write name=mymobilephaseloadings property=gradientStepTime/ /td td html:text property=percentage size=10 value=bean:write name=mymobilephaseloadings property=percentage// /td td html:cancel property=action value=Save bean:message key=button.save/ /html:cancel /td html:hidden property=page value=displaygradientstepbyidentifier/ /html:form /tr /logic:iterate - 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]
Nesting html:selec with logic:iterate in a strut application
Hi: I have a struts application that allows me to update a list of employees data. The following is a 'desired' Update screen to update all employees information on 'one' screen: Employee Name Employee AgeDepartment (this is a drop down) Anderson, John 30 a drop-down list of Boston-branch departments to choose from Johnson, Mary 35 a drop-down list of Portland-branch departments to choose from Wilson Bob25 a drop-down list of L.A-branch departments to choose from My Data Beans: // the department property will be populated based on the selection from the drop-down // 'departmentDropDown'. Each employee has it's unique drop-down 'departmentDropDown'. public class EmployeeDTO { private String name; private String age; private String department; private ArrayList departmentDropDown; // this list can be different for different employees } Public class DepartmentBean { private String id; private String dName; } My EmployeeForm: public class EmployeeForm extends org.apache.struts.action.ActionForm implements Serializable { private ArrayList listOfEmployees; private EmployeeDTO employee; private ArrayList aDropDown; } My UpdateEmployees.jsp: jsp:useBean id=listOfEmployees type=java.util.Collection scope=session/ logic:iterate id=emp name=listOfEmployees type=com.myCompany.EmployeeDTO tr tdhtml:text property=name//td tdhtml:text property=age//td td html:select name=emp property=department html:options collection=emp.departmentDropDown property=id labelProperty=dName/ /html:select /td /tr /logic:iterate ** listOfEmployees is an ArrayList of 'EmployeeDTO' in session. ** each empoloyee's departmentDropDown has been set as an ArrayList of 'DepartmentBean'. But when I ran I keep getting an error like this: Cannot find bean under name emp.departmentDropDown' javax.servlet.jsp.JspException: Cannot find bean under name emp.departmentDropDown at org.apache.struts.taglib.html.OptionsTag.getIterator( Did I struture my html:options within the logic:iterate wrong? If it is wrong, how do I display a html:options within a logic:iterate? -- I modiefied my JSP and tried another way but it doesn't work either: jsp:useBean id=listOfEmployees type=java.util.Collection scope=session/ logic:iterate id=emp name=listOfEmployees type=com.myCompany.EmployeeDTO bean:define id=aDropDown property=emp.departmentDropDown tr tdhtml:text property=name//td tdhtml:text property=age//td td html:select name=emp property=department html:options collection=aDropDown property=id labelProperty=dName/ /html:select /td /tr /logic:iterate Then I will get this error: [ServletException in:/jsp/part/editSubsystemPart.jsp] Cannot find bean under name aDropDown' javax.servlet.jsp.JspException: Cannot find bean under name aDropDown at org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:407) at Any help will be appreciated... Stella - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:iterate and table display
Erik Weber wrote the following on 10/16/2004 10:28 PM: but I think there's not much the Struts tags do that the JSTL tags can't do. Agreed, except the html form and netsted tags are nice and handy. Other than those I try and use JSTL (although I'm also using logic:present tag since it provides nice funtionality for a comma separated list of roles to check). -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic:iterate and table display
Can you tell how to use EL code. Am kind of newbie to Struts and and not much aware of EL tags. But my containier is only JSP 1.2 Also I am using struts 1.1 -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Saturday, October 16, 2004 7:57 PM To: Struts Users Mailing List Subject: Re: logic:iterate and table display Vijay Vishvas Dharap wrote the following on 10/15/2004 9:41 PM: Hi all, I have following scenario.. I have FormBean which has getter and setter for my VO object In VO I have a list of another VO. Now on this form I want to display the contents of the list using logic.iterate tags. I will make matter simpler saying... aFormBean has aVO which as list of bVO. bVO has attributes like xAttr, yAttr, zAttr. now aForm should show on the page table where contents of list of bVO will be giving one one row of the table. You can do this with struts logic and bean:write,I'm used to JSTL so here it is... c:forEach items=${yourFormName.aVo.bVOlist} var=bVOitem c:out value='${bVOitem.xAttr}'/ %-- or JSP2.0 just ${bVOitem.xAttr} --% c:out value='${bVOitem.yAttr}'/ /c:forEach with logic iterate within your html:form tags (I 'think' this is right?) //use the EL struts tags if not using JSP2.0 Container logic:iterate property=aVo.bVOlist id=bVOitem bean:write name=bVOitem property=xAttr/ bean:write name=bVOitem property=yAttr/ /logic:iterate Obviously you would surround the above with table tags etc. Or you could also use the display tag (search google or archives) that will do this for you. -- Rick - 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: logic:iterate and table display
Unfortunately, the Struts documentation isn't much help this department (unless I'm missing something), except that I think it tells you which Struts tags *don't* support the EL. But this page ought to help: http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL4.html There is also a blurb about using the EL in the Struts FAQ entry on indexed properties. If you look in your Struts distribution, you'll see the EL-related stuff in the contrib directory. You use the Struts EL tags the same way as you use the regular Struts tags (except you use the EL instead of using the old-fashioned runtime expression language). For example: bean-el:size collection=${someBean.someCollection} id=numItems/ This Struts tag assumes there is a bean called someBean which exposes a collection via the no-arg method getSomeCollection. It makes the size of the collection available via the numItems variable, which can be used subsequently like this, for example: c:when test=${numItems 0}/ There may be more efficient ways to do the same thing, but this gives you an example of a Struts tag and a JSTL tag that each use the EL. I recommend the book JSTL by Sue Spielman (Morgan Kaufmann, 0-12-656755-7). It's only $20 new and worth it. It discusses the JSTL tags and the EL in depth and is based on example. I have found that using a combination of the Struts tags and JSTL tags made my JSPs the nicest, but I think there's not much the Struts tags do that the JSTL tags can't do. Hope that helps, Erik Vijay Vishvas Dharap wrote: Can you tell how to use EL code. Am kind of newbie to Struts and and not much aware of EL tags. But my containier is only JSP 1.2 Also I am using struts 1.1 -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Saturday, October 16, 2004 7:57 PM To: Struts Users Mailing List Subject: Re: logic:iterate and table display Vijay Vishvas Dharap wrote the following on 10/15/2004 9:41 PM: Hi all, I have following scenario.. I have FormBean which has getter and setter for my VO object In VO I have a list of another VO. Now on this form I want to display the contents of the list using logic.iterate tags. I will make matter simpler saying... aFormBean has aVO which as list of bVO. bVO has attributes like xAttr, yAttr, zAttr. now aForm should show on the page table where contents of list of bVO will be giving one one row of the table. You can do this with struts logic and bean:write,I'm used to JSTL so here it is... c:forEach items=${yourFormName.aVo.bVOlist} var=bVOitem c:out value='${bVOitem.xAttr}'/ %-- or JSP2.0 just ${bVOitem.xAttr} --% c:out value='${bVOitem.yAttr}'/ /c:forEach with logic iterate within your html:form tags (I 'think' this is right?) //use the EL struts tags if not using JSP2.0 Container logic:iterate property=aVo.bVOlist id=bVOitem bean:write name=bVOitem property=xAttr/ bean:write name=bVOitem property=yAttr/ /logic:iterate Obviously you would surround the above with table tags etc. Or you could also use the display tag (search google or archives) that will do this for you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic:iterate and table display
Hi all, I have following scenario.. I have FormBean which has getter and setter for my VO object In VO I have a list of another VO. Now on this form I want to display the contents of the list using logic.iterate tags. I will make matter simpler saying... aFormBean has aVO which as list of bVO. bVO has attributes like xAttr, yAttr, zAttr. now aForm should show on the page table where contents of list of bVO will be giving one one row of the table. Any help is appreciated. Thanks, Vijay dharap - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nested logic:iterate tags
Hi ML... I have kind of a problem which I just can't get solved! I have an iterate tag inside an iterate tag, but in the nested iterate tag I need the indexed value from the outer iterate tag!! I have: html:form action=/storeCombiQuestion.do logic:present name=subQuestions scope=session logic:iterate name=subQuestions id=question indexId=subQuestion bean:write name=question property=text / logic:match name=question value=SingleChoice logic:iterate name=question property=possibleChoices id=option type=dk.procore.model.Option html:radio property=answer value=%=option.getOption()% indexed=true bean:write name=option property=option / /html:radio /logic:iterate br / /logic:match /logic:iterate /logic:present html:submit / /html:form Now.. The problem lies in the nested iterate tag. The indexed=true takes the value from the iterate tag in which it is nested, but what I really need is the one from the outer tag, which is called subQuestion. The reason I need the 'outer' is because the html:radio is dependant on it. I'm not even sure it can be done this way, but if it can't then I would like a suggestion of what to do then... Thanks in advance... Claus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]