Re: [S2] Retrieving values from the valuestack for the s:iterator tag
I want to iterate over the dataColumns to get the value from each dataColumn. I am trying to add S2 to an existing project. So the Vector code is old, circa 2001. Thanks for you help. newton.dave wrote: --- Justin Frost [EMAIL PROTECTED] wrote: private String value; public String getValue() { return value; } I want to use the s:iterator tag on value. What? Do you mean you want to iterate over the rows in the report? value is a string; nothing to iterate over. report.headerRow will iterate over each item in the headerRow Vector. (Consider naming it as a plural.) Then iterate over the dataColumns in each headerRow item, and the value will be visible. Haven't seen a Vector for awhile. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--Retrieving-values-from-the-valuestack-for-the-%3Cs%3Aiterator%3E-tag-tf4767834.html#a13647619 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Retrieving values from the valuestack for the s:iterator tag
So your container heirarchy is... Report - contains a Vector of ReportRow (called headerRow) - contains a Vector of ReportCell (called dataColumn) Shouldn't this just be a matter of a couple of nested loops? Something like... s:iterator value=report.getHeaderRow() s:iterator value=getDataColumns s:property value=value/ /s:iterator /s:iterator Does that (or the corrected syntax for that idea) not work? For myself, I'd probably be tempted to *not* do the nested loop in the view and do it in the Report itself. Something like... public List getAllReportCells() { List allReportCells = new ArrayList(); .. nested looping here adding each ReportCell to the list return allReportCells } s:iterator value=report.getAllReportCells s:property value=value/ /s:iterator -- This is all off the top of my head so don't expect a copy-and-paste of this to actually work. :-) What's confusing you, specifically? Is it how to refer to a property of the action in the s:iterator value part? Is it what to put in the value part of the property tag? Are you worried that the fact this is a Vector makes it not work with standard iteration techniques? Seems like a very straightforward task, so I'm thinking that I'm not understanding what the problem really is. - Gary Justin Frost wrote: I am having a difficult time figuring out a solution to my problem. I think I will start out with my class structure first. I only put in this message what I thought was valuable. public class Report implements java.io.Serializable { private java.lang.String title = ; private Vector headerRow = new Vector(); //Vector of ReportRow objects public Vector getHeaderRow() { return headerRow; } public String getTitle() { return title; } } public class ReportRow implements java.io.Serializable { private Vector dataColumns= new Vector(); // Vector of ReportCell Objects public Vector getDataColumns() { return dataColumns; } } public class ReportCell implements java.io.Serializable { private String value; public String getValue() { return value; } } public class ReportAction extends ActionSupport{ private ReportNew report; public ReportNew getReport() { // This gives me access to title return report; } // I need some other getter to retrieve my value attribute // But I am unsure of how to go about it. } I want to use the s:iterator tag on value. Something like below. s:iterator value=?? th s:property value=value/ /th /s:iterator I can not figure out what method I need in my Action class to allow the values to be visible. Can someone help me out. Or is there a good example out there that I can reference? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Retrieving values from the valuestack for the s:iterator tag
Justin Frost wrote: s:iterator value=report.headerRow s:iterator value=dataColumns th s:property value=value/ /th /s:iterator /s:iterator Well, you're doing exactly (almost) what I suggested so obviously more digging needs to be done. Here's where I'd start to dig: 1) Does the struts taglib iterator support Vectors? It should (if you're running this on a recent JVM), but it would be good to double-check. Speaking of JVM's, what JVM are you running this on? Vector was updated at some point to support the standard Collection stuff but I don't know when that happened. I suppose if you're running under an old JVM, Vector might not be able to do what you hope it can do. 2) Are your OGNL references working the way you think? Your first iterator refers to a property of the report object: report.headerRow. Is that the right syntax? Should be, but you might also try report.getHeaderRow(). Perhaps some vagary of OGNL is tripping you up. 3) Does the OGNL stack have on it what you think it has on it? You can use either the DebuggingInterceptor or the debug tag to get behind-the-scenes info. The debug tag is poorly documented, I think it requires the dojo library. Or something. :-) You might be better off with the interceptor: http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.html --- That's all I got. :-) - Gary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Retrieving values from the valuestack for the s:iterator tag
--- Gary Affonso [EMAIL PROTECTED] wrote: The debug tag is poorly documented, I think it requires the dojo library. Or something. :-) You can't tell me that http://struts.apache.org/2.x/docs/debug.html isn't the acme of documentation (I'll add something). In any case, no, it doesn't require Dojo--it just drops a bunch of info into a hidden DIV and gives you a link to show it. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Retrieving values from the valuestack for the s:iterator tag
This is the jsp I am using with no success. I thought it would be straight forward. Obviously I am missing something. s:iterator value=report.headerRow s:iterator value=dataColumns th s:property value=value/ /th /s:iterator /s:iterator Justin Frost wrote: I want to iterate over the dataColumns to get the value from each dataColumn. I am trying to add S2 to an existing project. So the Vector code is old, circa 2001. Thanks for you help. newton.dave wrote: --- Justin Frost [EMAIL PROTECTED] wrote: private String value; public String getValue() { return value; } I want to use the s:iterator tag on value. What? Do you mean you want to iterate over the rows in the report? value is a string; nothing to iterate over. report.headerRow will iterate over each item in the headerRow Vector. (Consider naming it as a plural.) Then iterate over the dataColumns in each headerRow item, and the value will be visible. Haven't seen a Vector for awhile. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--Retrieving-values-from-the-valuestack-for-the-%3Cs%3Aiterator%3E-tag-tf4767834.html#a13650450 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Solved] [S2] Retrieving values from the valuestack for the s:iterator tag
Here is what I figured out so far. headerRow is a vector of ReportCell, not ReportRow. So for the headerRow I had to create a getHeaderRow method in my action class. public Vector getHeaderRow(){ Report report = getReport(); return report.getHeaderRow(); } Then my jsp to display it looks like: s:iterator value=headerRow th s:property value=value/ /th /s:iterator There was also a dataRows vector in Report. Using my previous iterator setup on dataRows worked as expected. -Justin newton.dave wrote: --- Gary Affonso [EMAIL PROTECTED] wrote: The debug tag is poorly documented, I think it requires the dojo library. Or something. :-) You can't tell me that http://struts.apache.org/2.x/docs/debug.html isn't the acme of documentation (I'll add something). In any case, no, it doesn't require Dojo--it just drops a bunch of info into a hidden DIV and gives you a link to show it. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--Retrieving-values-from-the-valuestack-for-the-%3Cs%3Aiterator%3E-tag-tf4767834.html#a13655120 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] Retrieving values from the valuestack for the s:iterator tag
I am having a difficult time figuring out a solution to my problem. I think I will start out with my class structure first. I only put in this message what I thought was valuable. public class Report implements java.io.Serializable { private java.lang.String title = ; private Vector headerRow = new Vector(); //Vector of ReportRow objects public Vector getHeaderRow() { return headerRow; } public String getTitle() { return title; } } public class ReportRow implements java.io.Serializable { private Vector dataColumns= new Vector(); // Vector of ReportCell Objects public Vector getDataColumns() { return dataColumns; } } public class ReportCell implements java.io.Serializable { private String value; public String getValue() { return value; } } public class ReportAction extends ActionSupport{ private ReportNew report; public ReportNew getReport() { // This gives me access to title return report; } // I need some other getter to retrieve my value attribute // But I am unsure of how to go about it. } I want to use the s:iterator tag on value. Something like below. s:iterator value=?? th s:property value=value/ /th /s:iterator I can not figure out what method I need in my Action class to allow the values to be visible. Can someone help me out. Or is there a good example out there that I can reference? Thanks in advance. -- View this message in context: http://www.nabble.com/-S2--Retrieving-values-from-the-valuestack-for-the-%3Cs%3Aiterator%3E-tag-tf4767834.html#a13637580 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Retrieving values from the valuestack for the s:iterator tag
--- Justin Frost [EMAIL PROTECTED] wrote: private String value; public String getValue() { return value; } I want to use the s:iterator tag on value. What? Do you mean you want to iterate over the rows in the report? value is a string; nothing to iterate over. report.headerRow will iterate over each item in the headerRow Vector. (Consider naming it as a plural.) Then iterate over the dataColumns in each headerRow item, and the value will be visible. Haven't seen a Vector for awhile. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]