RE: Iterate Tag Question

2003-08-15 Thread Jones, Marty B.
Does anyone have any suggestions on how I can compare the previous object's
parameters to determine when my object's category has changed?

-Original Message-
From: Jones, Marty B. 
Sent: Friday, August 15, 2003 7:07 AM
To: [EMAIL PROTECTED]
Subject: Iterate Tag Question


I am using an iterate tag to iterate over a List of items that have a given
category.  I need to be able to determine when a given category has changed
when iterating and push out a header row in a table that I am generating.
Is there a way that I can look back a row or save the category from the
previous row so that I can compare it with the current row to determine
whether or not a category break has occurred.   Here is a snippet of my
code:


%
String previousCategory = empty;
%

table width=100% border=1 cellspacing=0 cellpadding=3
frame=hsides
tr
th align=left nowrapFilename/th
th align=centerDescription/th
/tr
logic:iterate id=currElement name=dbFileBean property=records
indexId=index
logic:notEqual name=currElement.categoryName
value=%=previousCategory%
tr
td colspan=6
class=groupBreakbbean:write name=currElement
property=categoryDesc//ba name=bean:write name=currElement
property=categoryName//a/td
/tr
/logic:notEqual
tr bgcolor=%=colors[index.intValue()%2]%
td align=left nowrapimg
src=/images/common/spacer.gif width=15 height=10
a
href=documentsandfiles?fileId=bean:write name=currElement
property=fileId/bean:write name=currElement
property=fileName//a
/td
td align=left
bean:write name=currElement
property=description/
/td
/tr
% previousCategory =
((DbFileInfo)currElement).getCategoryName();%  
/logic:iterate
/table


The way that I am attempting it from above is not working, the notEqual tag
is not seeing that the strings are equal.  I would like to be able to get
all the scriplets out of the jsp if possible.

Any suggestions would be appreciated.

Marty B. Jones
Senior Software Engineer
DailyAccess.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: Iterate Tag Question

2003-08-15 Thread Sgarlata Matt
You can implement this just as you would in any other programming 
environment: by saving the previous and the current value in different 
variables.  You can do this using scriptlets, as I see you doing here. 
You can also do this using the JSTL (for more info, see the Jakarta 
Taglibs project), which you may find a little easier to work with once 
you get the hang of it.

Does that answer your question?

Matt

Jones, Marty B. wrote:

Does anyone have any suggestions on how I can compare the previous object's
parameters to determine when my object's category has changed?
-Original Message-
From: Jones, Marty B. 
Sent: Friday, August 15, 2003 7:07 AM
To: [EMAIL PROTECTED]
Subject: Iterate Tag Question

I am using an iterate tag to iterate over a List of items that have a given
category.  I need to be able to determine when a given category has changed
when iterating and push out a header row in a table that I am generating.
Is there a way that I can look back a row or save the category from the
previous row so that I can compare it with the current row to determine
whether or not a category break has occurred.   Here is a snippet of my
code:
%
String previousCategory = empty;
%
table width=100% border=1 cellspacing=0 cellpadding=3
frame=hsides
tr
th align=left nowrapFilename/th
th align=centerDescription/th
/tr
logic:iterate id=currElement name=dbFileBean property=records
indexId=index
logic:notEqual name=currElement.categoryName
value=%=previousCategory%
tr
td colspan=6
class=groupBreakbbean:write name=currElement
property=categoryDesc//ba name=bean:write name=currElement
property=categoryName//a/td   
/tr
/logic:notEqual
tr bgcolor=%=colors[index.intValue()%2]%
td align=left nowrapimg
src=/images/common/spacer.gif width=15 height=10
a
href=documentsandfiles?fileId=bean:write name=currElement
property=fileId/bean:write name=currElement
property=fileName//a
/td
td align=left
bean:write name=currElement
property=description/
/td
/tr
% previousCategory =
((DbFileInfo)currElement).getCategoryName();%   
/logic:iterate
/table  
The way that I am attempting it from above is not working, the notEqual tag
is not seeing that the strings are equal.  I would like to be able to get
all the scriplets out of the jsp if possible.
Any suggestions would be appreciated.

Marty B. Jones
Senior Software Engineer
DailyAccess.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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Iterate Tag Question

2003-08-15 Thread Jones, Marty B.
Matt,

Yes it does.  I was hoping to get rid of scriplets if possible.  I cannot
use JSTL yet because our jsp container does not support the jsp 1.2 spec.
(Jrun 3.1).  We are going to migrate to Jrun 4 soon which supports the jsp
1.2 spec so I will be able to use JSTL then.  Guess I will have to use
scriplets until
then.

Thanks,

Marty

-Original Message-
From: Sgarlata Matt [mailto:[EMAIL PROTECTED]
Sent: Friday, August 15, 2003 11:02 AM
To: Struts Users Mailing List
Subject: Re: Iterate Tag Question


You can implement this just as you would in any other programming 
environment: by saving the previous and the current value in different 
variables.  You can do this using scriptlets, as I see you doing here. 
You can also do this using the JSTL (for more info, see the Jakarta 
Taglibs project), which you may find a little easier to work with once 
you get the hang of it.

Does that answer your question?

Matt

Jones, Marty B. wrote:

 Does anyone have any suggestions on how I can compare the previous
object's
 parameters to determine when my object's category has changed?
 
 -Original Message-
 From: Jones, Marty B. 
 Sent: Friday, August 15, 2003 7:07 AM
 To: [EMAIL PROTECTED]
 Subject: Iterate Tag Question
 
 
 I am using an iterate tag to iterate over a List of items that have a
given
 category.  I need to be able to determine when a given category has
changed
 when iterating and push out a header row in a table that I am generating.
 Is there a way that I can look back a row or save the category from the
 previous row so that I can compare it with the current row to determine
 whether or not a category break has occurred.   Here is a snippet of my
 code:
 
 
 %
 String previousCategory = empty;
 %
 
 table width=100% border=1 cellspacing=0 cellpadding=3
 frame=hsides
   tr
   th align=left nowrapFilename/th
   th align=centerDescription/th
   /tr
   logic:iterate id=currElement name=dbFileBean property=records
 indexId=index
   logic:notEqual name=currElement.categoryName
 value=%=previousCategory%
   tr
   td colspan=6
 class=groupBreakbbean:write name=currElement
 property=categoryDesc//ba name=bean:write name=currElement
 property=categoryName//a/td  
   /tr
   /logic:notEqual
   tr bgcolor=%=colors[index.intValue()%2]%
   td align=left nowrapimg
 src=/images/common/spacer.gif width=15 height=10
   a
 href=documentsandfiles?fileId=bean:write name=currElement
 property=fileId/bean:write name=currElement
 property=fileName//a
   /td
   td align=left
   bean:write name=currElement
 property=description/
   /td
   /tr
   % previousCategory =
 ((DbFileInfo)currElement).getCategoryName();  %  
   /logic:iterate
 /table  
 
 
 The way that I am attempting it from above is not working, the notEqual
tag
 is not seeing that the strings are equal.  I would like to be able to get
 all the scriplets out of the jsp if possible.
 
 Any suggestions would be appreciated.
 
 Marty B. Jones
 Senior Software Engineer
 DailyAccess.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]
 


-
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: iterate tag question

2003-05-29 Thread Vinay Mhapankar

Is the / at the end there in real code?
   logic:iterate id=usersAttrib name=usersAttrib  /

If yes then remove it... and try.

Thanks.

-Vinay



-Original Message-
From: Per Lovdinger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 28, 2003 8:00 PM
To: [EMAIL PROTECTED]
Subject: iterate tag question


Hi there,
I'm Struts newie and have a question about the iterate
tag.
When I'm creating an ArrayList with 2 objects. For
some reason only one show up.
What am I doing wrong ?
I've attached the jsp page.
thanks in advance


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 5/19/2003
 
  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 5/19/2003
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Iterate tag question

2002-09-27 Thread John Owen

String[] is just an array of String. It has no iterator. You need a
Collection, List or Enumeration.

- Original Message -
From: Rea, Ron [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 27, 2002 1:35 PM
Subject: Iterate tag question


 I am trying to iterate through several array fields on my Form within the
 JSP, display the properties as a table on the page.  Using arrays should
 allow me to update the table data, however I cannot seem to get the
iterate
 tag to work.  The following is an example of what I'm doing.  Any ideas on
 how this iterate tag should look - I'm just trying to go through the
array,
 held in the ActionForm,  and display each occurance as a row in the JSP.

 ResponseProcessForm:

 public void setMsgCode(String[] msgCode) {
 this.msgCode = msgCode;
 }

 public String[] getMsgCode() {
 return msgCode;
 }

 public void setMsgDesc(String[] msgDesc) {
 this.msgDesc = msgDesc;
 }

 public String[] getMsgDesc() {
 return msgDesc;
 }

 section of JSP:

 logic:iterate id=grid
  name=responseProcessForm
 property=msgCode
 td bean:write name=grid property=msgCode
 filter=true/ nbsp;/td
 tdhtml:text property=msgDesc size=6
 maxlength=6 /nbsp;/td
 /logic:iterate

 Using this code gives me this error: javax.servlet.ServletException: No
 getter method for property msgCode of bean grid

 Thanks!


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Iterate tag question

2002-09-27 Thread Rea, Ron

I originally had it as an arraylist of these properties, but using an
ArrayList in the Iterate tag prevents me from being able to edit the
individual table row data, then hit one submit button at the end.  Any
changes are lost.  

I tried following Husted's instructions on how to do this, found at this
link: http://www.husted.com/struts/tips/006.html, but the instructions are
not complete enough and I cannot get the iterate tag to work.  



-Original Message-
From: John Owen [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 27, 2002 12:03 PM
To: Struts Users Mailing List
Subject: Re: Iterate tag question

String[] is just an array of String. It has no iterator. You need a
Collection, List or Enumeration.

- Original Message -
From: Rea, Ron [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 27, 2002 1:35 PM
Subject: Iterate tag question


 I am trying to iterate through several array fields on my Form within the
 JSP, display the properties as a table on the page.  Using arrays should
 allow me to update the table data, however I cannot seem to get the
iterate
 tag to work.  The following is an example of what I'm doing.  Any ideas on
 how this iterate tag should look - I'm just trying to go through the
array,
 held in the ActionForm,  and display each occurance as a row in the JSP.

 ResponseProcessForm:

 public void setMsgCode(String[] msgCode) {
 this.msgCode = msgCode;
 }

 public String[] getMsgCode() {
 return msgCode;
 }

 public void setMsgDesc(String[] msgDesc) {
 this.msgDesc = msgDesc;
 }

 public String[] getMsgDesc() {
 return msgDesc;
 }

 section of JSP:

 logic:iterate id=grid
  name=responseProcessForm
 property=msgCode
 td bean:write name=grid property=msgCode
 filter=true/ nbsp;/td
 tdhtml:text property=msgDesc size=6
 maxlength=6 /nbsp;/td
 /logic:iterate

 Using this code gives me this error: javax.servlet.ServletException: No
 getter method for property msgCode of bean grid

 Thanks!


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



RE: Iterate tag question

2002-09-27 Thread Joe Barefoot



 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 12:05 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 I originally had it as an arraylist of these properties, but using an
 ArrayList in the Iterate tag prevents me from being able to edit the

First, how would using an ArrayList prevent you from doing any edits you could do with 
an array?  Edit within the action, right?

Second, in your snippet, you are using html:text, which expects a single Object, but 
your getter is returning a String[].  Not what you want to do.  If you really want to 
use an array here, make it an array of a tuple object (even with an ArrayList, this is 
the way to do it)...one that has getCode() and getDesc() methods.  Then you iterate 
through these objects, outputting your code and description.  Don't use two string 
arrays or two ArrayLists.

peace,
Joe


 individual table row data, then hit one submit button at the end.  Any
 changes are lost.  
 
 I tried following Husted's instructions on how to do this, 
 found at this
 link: http://www.husted.com/struts/tips/006.html, but the 
 instructions are
 not complete enough and I cannot get the iterate tag to work.  
 
 
 
 -Original Message-
 From: John Owen [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 12:03 PM
 To: Struts Users Mailing List
 Subject: Re: Iterate tag question
 
 String[] is just an array of String. It has no iterator. You need a
 Collection, List or Enumeration.
 
 - Original Message -
 From: Rea, Ron [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, September 27, 2002 1:35 PM
 Subject: Iterate tag question
 
 
  I am trying to iterate through several array fields on my 
 Form within the
  JSP, display the properties as a table on the page.  Using 
 arrays should
  allow me to update the table data, however I cannot seem to get the
 iterate
  tag to work.  The following is an example of what I'm 
 doing.  Any ideas on
  how this iterate tag should look - I'm just trying to go through the
 array,
  held in the ActionForm,  and display each occurance as a 
 row in the JSP.
 
  ResponseProcessForm:
 
  public void setMsgCode(String[] msgCode) {
  this.msgCode = msgCode;
  }
 
  public String[] getMsgCode() {
  return msgCode;
  }
 
  public void setMsgDesc(String[] msgDesc) {
  this.msgDesc = msgDesc;
  }
 
  public String[] getMsgDesc() {
  return msgDesc;
  }
 
  section of JSP:
 
  logic:iterate id=grid
   name=responseProcessForm
  property=msgCode
  td bean:write name=grid 
 property=msgCode
  filter=true/ nbsp;/td
  tdhtml:text property=msgDesc size=6
  maxlength=6 /nbsp;/td
  /logic:iterate
 
  Using this code gives me this error: 
 javax.servlet.ServletException: No
  getter method for property msgCode of bean grid
 
  Thanks!
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Iterate tag question

2002-09-27 Thread Rea, Ron

If you have a working example of how I could actually modify properties
presented through an ArrayList, I would be forever grateful g to see that.
I have no problem presenting an ArrayList of properties, but everything I
have read indicates that you have to nead an edit button on each row in
order to send changed data back to the Action class.  Our users want a table
of data presented back to them, where they can make changes to each row,
then hit submit at the end and have the Action class update the data table
with the edits.  Unfortunately, I have not been able to do this using an
ArrayList, and I think the link to Husted's site indicated the same, but
maybe I'm wrong.   If you have, I'd really like to know how you did it.

Thanks!

-Original Message-
From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 27, 2002 12:15 PM
To: Struts Users Mailing List
Subject: RE: Iterate tag question



 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 12:05 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 I originally had it as an arraylist of these properties, but using an
 ArrayList in the Iterate tag prevents me from being able to edit the

First, how would using an ArrayList prevent you from doing any edits you
could do with an array?  Edit within the action, right?

Second, in your snippet, you are using html:text, which expects a single
Object, but your getter is returning a String[].  Not what you want to do.
If you really want to use an array here, make it an array of a tuple object
(even with an ArrayList, this is the way to do it)...one that has getCode()
and getDesc() methods.  Then you iterate through these objects, outputting
your code and description.  Don't use two string arrays or two ArrayLists.

peace,
Joe


 individual table row data, then hit one submit button at the end.  Any
 changes are lost.  
 
 I tried following Husted's instructions on how to do this, 
 found at this
 link: http://www.husted.com/struts/tips/006.html, but the 
 instructions are
 not complete enough and I cannot get the iterate tag to work.  
 
 
 
 -Original Message-
 From: John Owen [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 12:03 PM
 To: Struts Users Mailing List
 Subject: Re: Iterate tag question
 
 String[] is just an array of String. It has no iterator. You need a
 Collection, List or Enumeration.
 
 - Original Message -
 From: Rea, Ron [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, September 27, 2002 1:35 PM
 Subject: Iterate tag question
 
 
  I am trying to iterate through several array fields on my 
 Form within the
  JSP, display the properties as a table on the page.  Using 
 arrays should
  allow me to update the table data, however I cannot seem to get the
 iterate
  tag to work.  The following is an example of what I'm 
 doing.  Any ideas on
  how this iterate tag should look - I'm just trying to go through the
 array,
  held in the ActionForm,  and display each occurance as a 
 row in the JSP.
 
  ResponseProcessForm:
 
  public void setMsgCode(String[] msgCode) {
  this.msgCode = msgCode;
  }
 
  public String[] getMsgCode() {
  return msgCode;
  }
 
  public void setMsgDesc(String[] msgDesc) {
  this.msgDesc = msgDesc;
  }
 
  public String[] getMsgDesc() {
  return msgDesc;
  }
 
  section of JSP:
 
  logic:iterate id=grid
   name=responseProcessForm
  property=msgCode
  td bean:write name=grid 
 property=msgCode
  filter=true/ nbsp;/td
  tdhtml:text property=msgDesc size=6
  maxlength=6 /nbsp;/td
  /logic:iterate
 
  Using this code gives me this error: 
 javax.servlet.ServletException: No
  getter method for property msgCode of bean grid
 
  Thanks!
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



RE: Iterate tag question

2002-09-27 Thread Joe Barefoot

Okay, now I understand what you meant by edit.  You might be right about needing to 
use an array in this case, as I have never had to do exactly what you're doing.  So, 
if you want to proceed in this vein, I *think* you should do something like this:


logic:iterate id=grid name=responseProcessForm property=msgCode indexID=index
td bean:write name='responseProcessForm' property='%= msgCode[ + 
index.intValue() + ] %' filter='true'/ nbsp;/td
  tdhtml:text name='responseProcessForm' property='%= msgDesc[ + 
index.intValue() + ] %' size='6' maxlength=6 /nbsp;/td
/logic:iterate


Couple of things to note here:

1.  You are only using the iterate tag to get the index value.  Your two arrays must 
be of the same length of course, and it doesn't matter which one you iterate through.
2.  You are not using the id attribute of the iterage tag at all, but I *think* it's 
required, so I left it there.
3.  The index is actually a big Integer, hence the intValue() method call.
4.  The attributes have single quotes around them for a reason.  There are String 
literals embedded in the JSP expressions in the attributes...usually the double quotes 
confuse the JSP compiler, so I put single quotes around the attribute value itself.  
This is valid, but you can't mix usage within a tag (i.e. single and double for 
attributes)
5.  You may want to replace the String literals I have used with prefix/suffix 
variables created from bean:define tags.  That was you can eliminate some of the 
quotes and it might look cleaner to you.

6. (this is the important one) I've never had to do this, but AFAIK this should work 
just fine.

7.  Hey, let me know if this works. ;)

peace,
Joe


 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 12:29 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 If you have a working example of how I could actually modify 
 properties
 presented through an ArrayList, I would be forever grateful 
 g to see that.
 I have no problem presenting an ArrayList of properties, but 
 everything I
 have read indicates that you have to nead an edit button on 
 each row in
 order to send changed data back to the Action class.  Our 
 users want a table
 of data presented back to them, where they can make changes 
 to each row,
 then hit submit at the end and have the Action class update 
 the data table
 with the edits.  Unfortunately, I have not been able to do 
 this using an
 ArrayList, and I think the link to Husted's site indicated 
 the same, but
 maybe I'm wrong.   If you have, I'd really like to know how 
 you did it.
 
 Thanks!
 
 -Original Message-
 From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 12:15 PM
 To: Struts Users Mailing List
 Subject: RE: Iterate tag question
 
 
 
  -Original Message-
  From: Rea, Ron [mailto:[EMAIL PROTECTED]]
  Sent: Friday, September 27, 2002 12:05 PM
  To: 'Struts Users Mailing List'
  Subject: RE: Iterate tag question
  
  
  I originally had it as an arraylist of these properties, 
 but using an
  ArrayList in the Iterate tag prevents me from being able to edit the
 
 First, how would using an ArrayList prevent you from doing 
 any edits you
 could do with an array?  Edit within the action, right?
 
 Second, in your snippet, you are using html:text, which 
 expects a single
 Object, but your getter is returning a String[].  Not what 
 you want to do.
 If you really want to use an array here, make it an array of 
 a tuple object
 (even with an ArrayList, this is the way to do it)...one that 
 has getCode()
 and getDesc() methods.  Then you iterate through these 
 objects, outputting
 your code and description.  Don't use two string arrays or 
 two ArrayLists.
 
 peace,
 Joe
 
 
  individual table row data, then hit one submit button at 
 the end.  Any
  changes are lost.  
  
  I tried following Husted's instructions on how to do this, 
  found at this
  link: http://www.husted.com/struts/tips/006.html, but the 
  instructions are
  not complete enough and I cannot get the iterate tag to work.  
  
  
  
  -Original Message-
  From: John Owen [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, September 27, 2002 12:03 PM
  To: Struts Users Mailing List
  Subject: Re: Iterate tag question
  
  String[] is just an array of String. It has no iterator. You need a
  Collection, List or Enumeration.
  
  - Original Message -
  From: Rea, Ron [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, September 27, 2002 1:35 PM
  Subject: Iterate tag question
  
  
   I am trying to iterate through several array fields on my 
  Form within the
   JSP, display the properties as a table on the page.  Using 
  arrays should
   allow me to update the table data, however I cannot seem 
 to get the
  iterate
   tag to work.  The following is an example of what I'm 
  doing.  Any ideas on
   how this iterate tag should look - I'm just trying

RE: Iterate tag question

2002-09-27 Thread Rea, Ron

Thanks Joe!!

I'll give this a shot and let you know...

Ron

-Original Message-
From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 27, 2002 1:04 PM
To: Struts Users Mailing List
Subject: RE: Iterate tag question

Okay, now I understand what you meant by edit.  You might be right about
needing to use an array in this case, as I have never had to do exactly what
you're doing.  So, if you want to proceed in this vein, I *think* you should
do something like this:


logic:iterate id=grid name=responseProcessForm property=msgCode
indexID=index
td bean:write name='responseProcessForm' property='%= msgCode[
+ index.intValue() + ] %' filter='true'/ nbsp;/td
  tdhtml:text name='responseProcessForm' property='%= msgDesc[ +
index.intValue() + ] %' size='6' maxlength=6 /nbsp;/td
/logic:iterate


Couple of things to note here:

1.  You are only using the iterate tag to get the index value.  Your two
arrays must be of the same length of course, and it doesn't matter which one
you iterate through.
2.  You are not using the id attribute of the iterage tag at all, but I
*think* it's required, so I left it there.
3.  The index is actually a big Integer, hence the intValue() method call.
4.  The attributes have single quotes around them for a reason.  There are
String literals embedded in the JSP expressions in the attributes...usually
the double quotes confuse the JSP compiler, so I put single quotes around
the attribute value itself.  This is valid, but you can't mix usage within a
tag (i.e. single and double for attributes)
5.  You may want to replace the String literals I have used with
prefix/suffix variables created from bean:define tags.  That was you can
eliminate some of the quotes and it might look cleaner to you.

6. (this is the important one) I've never had to do this, but AFAIK this
should work just fine.

7.  Hey, let me know if this works. ;)

peace,
Joe


 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 12:29 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 If you have a working example of how I could actually modify 
 properties
 presented through an ArrayList, I would be forever grateful 
 g to see that.
 I have no problem presenting an ArrayList of properties, but 
 everything I
 have read indicates that you have to nead an edit button on 
 each row in
 order to send changed data back to the Action class.  Our 
 users want a table
 of data presented back to them, where they can make changes 
 to each row,
 then hit submit at the end and have the Action class update 
 the data table
 with the edits.  Unfortunately, I have not been able to do 
 this using an
 ArrayList, and I think the link to Husted's site indicated 
 the same, but
 maybe I'm wrong.   If you have, I'd really like to know how 
 you did it.
 
 Thanks!
 
 -Original Message-
 From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 12:15 PM
 To: Struts Users Mailing List
 Subject: RE: Iterate tag question
 
 
 
  -Original Message-
  From: Rea, Ron [mailto:[EMAIL PROTECTED]]
  Sent: Friday, September 27, 2002 12:05 PM
  To: 'Struts Users Mailing List'
  Subject: RE: Iterate tag question
  
  
  I originally had it as an arraylist of these properties, 
 but using an
  ArrayList in the Iterate tag prevents me from being able to edit the
 
 First, how would using an ArrayList prevent you from doing 
 any edits you
 could do with an array?  Edit within the action, right?
 
 Second, in your snippet, you are using html:text, which 
 expects a single
 Object, but your getter is returning a String[].  Not what 
 you want to do.
 If you really want to use an array here, make it an array of 
 a tuple object
 (even with an ArrayList, this is the way to do it)...one that 
 has getCode()
 and getDesc() methods.  Then you iterate through these 
 objects, outputting
 your code and description.  Don't use two string arrays or 
 two ArrayLists.
 
 peace,
 Joe
 
 
  individual table row data, then hit one submit button at 
 the end.  Any
  changes are lost.  
  
  I tried following Husted's instructions on how to do this, 
  found at this
  link: http://www.husted.com/struts/tips/006.html, but the 
  instructions are
  not complete enough and I cannot get the iterate tag to work.  
  
  
  
  -Original Message-
  From: John Owen [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, September 27, 2002 12:03 PM
  To: Struts Users Mailing List
  Subject: Re: Iterate tag question
  
  String[] is just an array of String. It has no iterator. You need a
  Collection, List or Enumeration.
  
  - Original Message -
  From: Rea, Ron [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, September 27, 2002 1:35 PM
  Subject: Iterate tag question
  
  
   I am trying to iterate through several array fields on my 
  Form within the
   JSP, display the properties as a table on the page.  Using 
  arrays

RE: Iterate tag question

2002-09-27 Thread Rea, Ron

Joe, 

This ammmst works.  It displays the data just fine, but I get the
following error when I hit submit:

javax.servlet.ServletException: No collection found

Seems that it wants a collection to iterate through??  What'cha think?

Ron

-Original Message-
From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 27, 2002 1:04 PM
To: Struts Users Mailing List
Subject: RE: Iterate tag question

Okay, now I understand what you meant by edit.  You might be right about
needing to use an array in this case, as I have never had to do exactly what
you're doing.  So, if you want to proceed in this vein, I *think* you should
do something like this:


logic:iterate id=grid name=responseProcessForm property=msgCode
indexID=index
td bean:write name='responseProcessForm' property='%= msgCode[
+ index.intValue() + ] %' filter='true'/ nbsp;/td
  tdhtml:text name='responseProcessForm' property='%= msgDesc[ +
index.intValue() + ] %' size='6' maxlength=6 /nbsp;/td
/logic:iterate


Couple of things to note here:

1.  You are only using the iterate tag to get the index value.  Your two
arrays must be of the same length of course, and it doesn't matter which one
you iterate through.
2.  You are not using the id attribute of the iterage tag at all, but I
*think* it's required, so I left it there.
3.  The index is actually a big Integer, hence the intValue() method call.
4.  The attributes have single quotes around them for a reason.  There are
String literals embedded in the JSP expressions in the attributes...usually
the double quotes confuse the JSP compiler, so I put single quotes around
the attribute value itself.  This is valid, but you can't mix usage within a
tag (i.e. single and double for attributes)
5.  You may want to replace the String literals I have used with
prefix/suffix variables created from bean:define tags.  That was you can
eliminate some of the quotes and it might look cleaner to you.

6. (this is the important one) I've never had to do this, but AFAIK this
should work just fine.

7.  Hey, let me know if this works. ;)

peace,
Joe


 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 12:29 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 If you have a working example of how I could actually modify 
 properties
 presented through an ArrayList, I would be forever grateful 
 g to see that.
 I have no problem presenting an ArrayList of properties, but 
 everything I
 have read indicates that you have to nead an edit button on 
 each row in
 order to send changed data back to the Action class.  Our 
 users want a table
 of data presented back to them, where they can make changes 
 to each row,
 then hit submit at the end and have the Action class update 
 the data table
 with the edits.  Unfortunately, I have not been able to do 
 this using an
 ArrayList, and I think the link to Husted's site indicated 
 the same, but
 maybe I'm wrong.   If you have, I'd really like to know how 
 you did it.
 
 Thanks!
 
 -Original Message-
 From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 12:15 PM
 To: Struts Users Mailing List
 Subject: RE: Iterate tag question
 
 
 
  -Original Message-
  From: Rea, Ron [mailto:[EMAIL PROTECTED]]
  Sent: Friday, September 27, 2002 12:05 PM
  To: 'Struts Users Mailing List'
  Subject: RE: Iterate tag question
  
  
  I originally had it as an arraylist of these properties, 
 but using an
  ArrayList in the Iterate tag prevents me from being able to edit the
 
 First, how would using an ArrayList prevent you from doing 
 any edits you
 could do with an array?  Edit within the action, right?
 
 Second, in your snippet, you are using html:text, which 
 expects a single
 Object, but your getter is returning a String[].  Not what 
 you want to do.
 If you really want to use an array here, make it an array of 
 a tuple object
 (even with an ArrayList, this is the way to do it)...one that 
 has getCode()
 and getDesc() methods.  Then you iterate through these 
 objects, outputting
 your code and description.  Don't use two string arrays or 
 two ArrayLists.
 
 peace,
 Joe
 
 
  individual table row data, then hit one submit button at 
 the end.  Any
  changes are lost.  
  
  I tried following Husted's instructions on how to do this, 
  found at this
  link: http://www.husted.com/struts/tips/006.html, but the 
  instructions are
  not complete enough and I cannot get the iterate tag to work.  
  
  
  
  -Original Message-
  From: John Owen [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, September 27, 2002 12:03 PM
  To: Struts Users Mailing List
  Subject: Re: Iterate tag question
  
  String[] is just an array of String. It has no iterator. You need a
  Collection, List or Enumeration.
  
  - Original Message -
  From: Rea, Ron [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, September 27, 2002 1:35 PM

RE: Iterate tag question

2002-09-27 Thread Joe Barefoot

Yeah, I was afraid of something like that. :)  Could you try replacing the two String 
arrays with two ArrayLists that contain your String objects?  That should be pretty 
easy, just change the method signature in your Action, iterate through the array you 
already have to create the ArrayList, and return it.  You won't need to change the 
JSP.  Might work, might not.

This is really the blind leading the blind at this point though...anybody else got a 
good handle on populating indexed properties from a form?  An array or a Collection?


peace,
Joe

P.S.  You might try searching the mail archives for indexed properties or 
populating indexed properties, I'm pretty sure this has come up before.


 -Original Message-
 From: Rea, Ron [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 27, 2002 2:28 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Iterate tag question
 
 
 Joe, 
 
 This ammmst works.  It displays the data just fine, 
 but I get the
 following error when I hit submit:
 
 javax.servlet.ServletException: No collection found
 
 Seems that it wants a collection to iterate through??  What'cha think?
 
 Ron
 
 -Original Message-
 From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, September 27, 2002 1:04 PM
 To: Struts Users Mailing List
 Subject: RE: Iterate tag question
 
 Okay, now I understand what you meant by edit.  You might 
 be right about
 needing to use an array in this case, as I have never had to 
 do exactly what
 you're doing.  So, if you want to proceed in this vein, I 
 *think* you should
 do something like this:
 
 
 logic:iterate id=grid name=responseProcessForm property=msgCode
 indexID=index
   td bean:write name='responseProcessForm' 
 property='%= msgCode[
 + index.intValue() + ] %' filter='true'/ nbsp;/td
   tdhtml:text name='responseProcessForm' property='%= 
 msgDesc[ +
 index.intValue() + ] %' size='6' maxlength=6 /nbsp;/td
 /logic:iterate
 
 
 Couple of things to note here:
 
 1.  You are only using the iterate tag to get the index 
 value.  Your two
 arrays must be of the same length of course, and it doesn't 
 matter which one
 you iterate through.
 2.  You are not using the id attribute of the iterage tag at 
 all, but I
 *think* it's required, so I left it there.
 3.  The index is actually a big Integer, hence the intValue() 
 method call.
 4.  The attributes have single quotes around them for a 
 reason.  There are
 String literals embedded in the JSP expressions in the 
 attributes...usually
 the double quotes confuse the JSP compiler, so I put single 
 quotes around
 the attribute value itself.  This is valid, but you can't mix 
 usage within a
 tag (i.e. single and double for attributes)
 5.  You may want to replace the String literals I have used with
 prefix/suffix variables created from bean:define tags.  That 
 was you can
 eliminate some of the quotes and it might look cleaner to you.
 
 6. (this is the important one) I've never had to do this, but 
 AFAIK this
 should work just fine.
 
 7.  Hey, let me know if this works. ;)
 
 peace,
 Joe
 
 
  -Original Message-
  From: Rea, Ron [mailto:[EMAIL PROTECTED]]
  Sent: Friday, September 27, 2002 12:29 PM
  To: 'Struts Users Mailing List'
  Subject: RE: Iterate tag question
  
  
  If you have a working example of how I could actually modify 
  properties
  presented through an ArrayList, I would be forever grateful 
  g to see that.
  I have no problem presenting an ArrayList of properties, but 
  everything I
  have read indicates that you have to nead an edit button on 
  each row in
  order to send changed data back to the Action class.  Our 
  users want a table
  of data presented back to them, where they can make changes 
  to each row,
  then hit submit at the end and have the Action class update 
  the data table
  with the edits.  Unfortunately, I have not been able to do 
  this using an
  ArrayList, and I think the link to Husted's site indicated 
  the same, but
  maybe I'm wrong.   If you have, I'd really like to know how 
  you did it.
  
  Thanks!
  
  -Original Message-
  From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, September 27, 2002 12:15 PM
  To: Struts Users Mailing List
  Subject: RE: Iterate tag question
  
  
  
   -Original Message-
   From: Rea, Ron [mailto:[EMAIL PROTECTED]]
   Sent: Friday, September 27, 2002 12:05 PM
   To: 'Struts Users Mailing List'
   Subject: RE: Iterate tag question
   
   
   I originally had it as an arraylist of these properties, 
  but using an
   ArrayList in the Iterate tag prevents me from being able 
 to edit the
  
  First, how would using an ArrayList prevent you from doing 
  any edits you
  could do with an array?  Edit within the action, right?
  
  Second, in your snippet, you are using html:text, which 
  expects a single
  Object, but your getter is returning a String[].  Not what 
  you want to do.
  If you really want to use an array here, make it an array

Re: iterate tag question

2001-11-12 Thread Peter Pilgrim



This is wrong. You are only assignment ArrayList element thats refer to
the same object instance `strMenu'.

What you need to do is
ArrayList alMenu = new ArrayList();
String strMenu[] = new String[2];
strMenu[0] = Tenant Information;
strMenu[1] = /TenantInfo;
alMenu.add(strMenu);
strMenu[] = new String[2];
strMenu[0] = Tenant Information;
strMenu[1] = /TenantInfo;
alMenu.add(strMenu);

But this is clumsy. Borrow the `LabelValueBean' from Struts
Example or write an association class for you own project
Then you can write __better__ Java code.

  ArrayList alMenu = new ArrayList(
  LabelValue labVal = new LabelValue(
   Tenant Information,
   /TenantInfo );
alMenu.add( labVal );

Or even more elegantly:

  ArrayList alMenu = new ArrayList(
  alMenu.add( new LabelValue(
   Tenant Information,
   /TenantInfo ) );
  alMenu.add( new LabelValue(
   Service charge data,
   /Charges ) );

Benefit of this you put the collection is request or session scope.

  request.setAttribute( MY_COLLECTION_LIST, almenu );

You grab it with the html:options custom action like this
( assume the LabelValueBean has two method called getOptionName and
getOptionValue )

  bean:define id=privateDancer name=MY_COLLECTION_LIST /
  html:options collection=privateDancer
   property=optionValue
   labelProperty=optionName /

Eh voila!
--
Peter Pilgrim ++44 (0)207-545-9923
  //_\\
Mathematics is essentially the study of islands of  ===
disparate subjects in a sea of ignorance.   || ! ||
Andrew Wiles _


 Message History 



From: Frédéric Houbie - ABSIS-GROUP [EMAIL PROTECTED] on 08/11/2001 17:41 CET
--CUT--

Hi,

I need to use an arraylist in a iterate tag, i fill the arraylist with
String arrays like that :

ArrayList alMenu = new ArrayList();
String strMenu[] = new String[2];
strMenu[0] = Tenant Information;
strMenu[1] = /TenantInfo;
alMenu.add(strMenu);
strMenu[0] = Tenancy Schedule;
strMenu[1] = /TenantSched;
alMenu.add(strMenu);
strMenu[0] = Service charge data;
strMenu[1] = /Charges;
alMenu.add(strMenu);
strMenu[0] = Stacking Plan;
strMenu[1] = /StackingPlan;
alMenu.add(strMenu);
strMenu[0] = Tenants rental balance;
strMenu[1] = /TenantRental;
alMenu.add(strMenu);
strMenu[0] = Break dates calendar;
strMenu[1] = /BreakDates;
alMenu.add(strMenu);
session.setAttribute(Menu, alMenu);


how can I access the item of String array in jsp bean tag. Do I have to
write a class with getter and setter instead ?

--CUT--


--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Iterate Tag question, again -- Short ane sweet

2001-03-25 Thread Sundar @eSaravana



 On Sat, 24 Mar 2001, Sundar @eSaravana wrote:

  Hi,
 
  This is my situation:
  I have a collection(Vector) of buddyListForm as session attribute.
 
  So, in my JSP,
 
  logic:iterate id="buddylist" property="buddylist" scope="session" !--
  vector being iterated --

 If the Vector you are storing is under session key "buddyListForm", this
 should really say something like:
 logic:iterate id="buddy" name="buddylist" scope="session"


Nope, the vector of buddyListForm is under the session key "buddylist".
So just for clarity I modified my current code as following:

logic:iterate id="buddy" property="buddylist" scope="session" !-- fetches
the vector from session under key "buddylist --
logic:iterate id="buddy1" property="buddy" scope="session" !-- individual
bean --
tr
bean:write name= "buddy1"  property="name" filter="true"/
/tr
/logic:iterate
/logic:iterate

Still I am getting the same error
javax.servlet.jsp.JspException: Cannot find bean buddy1 in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:219)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
at
_0002fBuddyList_0002ejspBuddyList_jsp_48._jspService(_0002fBuddyList_0002ejs
pBuddyList_jsp_48.java:681)

And today I used 20010325 source release.


  !--Now, I have the individual bean, how do I iterate the properties--
  logic:iterate  id="buddy" name="buddylist" scope="session"
  tr
  bean:write name= "buddy"  property="name" filter="true"/
  /tr
  /logic:iterate
  /logic:iterate
 

 There was a bug several months ago where the "id" bean was not getting
 exposed correctly, but that has been fixed.  How old is the version of
 Struts you are using?

  All I get for this code is:
  javax.servlet.jsp.JspException: Cannot find bean buddy in scope null
  at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:212)
  at
 
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:
  .
 
  I am attaching buddyListForm, too.
 
  Sundar
 

 Craig


Sundar








Re: Iterate Tag question, again -- Short ane sweet

2001-03-25 Thread Craig R. McClanahan



On Sun, 25 Mar 2001, Sundar @eSaravana wrote:

 
 
  On Sat, 24 Mar 2001, Sundar @eSaravana wrote:
 
   Hi,
  
   This is my situation:
   I have a collection(Vector) of buddyListForm as session attribute.
  
   So, in my JSP,
  
   logic:iterate id="buddylist" property="buddylist" scope="session" !--
   vector being iterated --
 
  If the Vector you are storing is under session key "buddyListForm", this
  should really say something like:
  logic:iterate id="buddy" name="buddylist" scope="session"
 
 
 Nope, the vector of buddyListForm is under the session key "buddylist".
 So just for clarity I modified my current code as following:
 
 logic:iterate id="buddy" property="buddylist" scope="session" !-- fetches
 the vector from session under key "buddylist --
 logic:iterate id="buddy1" property="buddy" scope="session" !-- individual
 bean --
 tr
 bean:write name= "buddy1"  property="name" filter="true"/
 /tr
 /logic:iterate
 /logic:iterate
 

What I still don't understand is why are you using two nested iterate
tags?  You only need one tag to iterate over the contents of a Vector.

If you have a session attribute named "buddylist" that is a Vector,
iterate over it like this:


table
logic:iterate id="buddy" name="buddylist" scope="session"
  tr
tdbean:write name="buddy" property="name" filter="true"//td
  /tr
/logic:iterate
/table

Note that you refer to buddylist with a *name* attribute, not a *property*
attribute.

Craig




Re: Iterate Tag question, again -- Short ane sweet

2001-03-25 Thread Martin Cooper

Aside from the various errors, I think the answer to your original question
is "you can't do that".

Let me see if I understand what you want to do. You have a Vector whose
elements are of some bean class (BuddyListForm I believe). You want to
iterate over that Vector. Then, for each object, you want to iterate over
its properties. So, for your BuddyListForm, the body of the iterator would
be evaluated once for each of 'name', 'alias' and 'phoneno'. Is this right?

The iterate tag does not support this. It operates on collections,
iterators, maps, and arrays of objects. It does not support on-the-fly
generation of such a collection using introspection on a bean, which is what
would be needed for what you want to do.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Sundar @eSaravana" [EMAIL PROTECTED]
To: "Jaganathan, Rupa" [EMAIL PROTECTED]; "Craig R.
McClanahan" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, March 24, 2001 6:34 PM
Subject: Re: Iterate Tag question, again -- Short ane sweet


 Hi,

 This is my situation:
 I have a collection(Vector) of buddyListForm as session attribute.

 So, in my JSP,

 logic:iterate id="buddylist" property="buddylist" scope="session" !--
 vector being iterated --
 !--Now, I have the individual bean, how do I iterate the properties--
 logic:iterate  id="buddy" name="buddylist" scope="session"
 tr
 bean:write name= "buddy"  property="name" filter="true"/
 /tr
 /logic:iterate
 /logic:iterate

 All I get for this code is:
 javax.servlet.jsp.JspException: Cannot find bean buddy in scope null
 at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:212)
 at

org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:
 .

 I am attaching buddyListForm, too.

 Sundar


 - Original Message -
 From: "Craig R. McClanahan" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Friday, March 23, 2001 2:41 PM
 Subject: Re: Iterate Tag question, again -- Short ane sweet


 
 
  On Fri, 23 Mar 2001, Sundar @eSaravana wrote:
 
   Since nobody seemed to have read my long mail, I am re-writing my mail
 short
   and probably sweet.
  
   Can I do, multilevel iteration with iterate tag.?
   For example:
   I have collection of beans in my session. In my JSP, I want to first
 iterate
   at the collection to get the individual beans. And for every bean
again
   iterate to get attributes/variables.
 
  There is no current mechanism to iterate over the properties of a bean
  (which is what I *think* you meant by attributes/variables).  However,
if
  your bean had a method that returned all the interesting stuff as a Map
or
  something like that, you could certainly have a nested iteration over
  that.
 
  For example, consider a bean that has a getter method:
 
  public Map getProperties();
 
  and you had a collection of them called "beans".  Then you can:
 
  logic:iterate id="bean" name="beans"
Now processing bean bean:write name="bean" property="id"/
logic:iterate id="property" name="bean" property="properties"
  Property bean:write name="property" property="key"/
  has value bean:write name="property" property="value"/
/logic:iterate
  /logic:iterate
 
 
   Any help is deeply appreciated.
  
   Cheers...!
   Sundar
  
  
 
  Craig
 
 







RE: Iterate Tag question, again -- Short ane sweet

2001-03-25 Thread Nigel Ainslie

...maybe the problem is that you think you need two 'iterations'...you only
have one collection so you only need one iteration, each bean's properties
(attributes) can be obtained within the iteration (provided you have getter
methods :-) )

 logic:iterate id="theBean" name="theForm" property="theList"
!-- for each object in iterator render its properties --
  tr 
  bean:write name="theBean" property="property1"
filter="true"/br
  bean:write name="theBean" property="property2"
filter="true"/br
  bean:write name="theBean" property="property3"
filter="true"/br
  .etc..
  /tr
/table
 /logic:iterate

maybe

-Original Message-
From: Sundar @eSaravana [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 24 March 2001 4:12
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Iterate Tag question, again -- Short ane sweet


Since nobody seemed to have read my long mail, I am re-writing my mail short
and probably sweet.

Can I do, multilevel iteration with iterate tag.?
For example:
I have collection of beans in my session. In my JSP, I want to first iterate
at the collection to get the individual beans. And for every bean again
iterate to get attributes/variables.

Any help is deeply appreciated.

Cheers...!
Sundar



Re: Iterate Tag question, again -- Short ane sweet

2001-03-24 Thread Sundar @eSaravana

Hi,

This is my situation:
I have a collection(Vector) of buddyListForm as session attribute.

So, in my JSP,

logic:iterate id="buddylist" property="buddylist" scope="session" !--
vector being iterated --
!--Now, I have the individual bean, how do I iterate the properties--
logic:iterate  id="buddy" name="buddylist" scope="session"
tr
bean:write name= "buddy"  property="name" filter="true"/
/tr
/logic:iterate
/logic:iterate

All I get for this code is:
javax.servlet.jsp.JspException: Cannot find bean buddy in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:212)
at
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:
.

I am attaching buddyListForm, too.

Sundar


- Original Message -
From: "Craig R. McClanahan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 23, 2001 2:41 PM
Subject: Re: Iterate Tag question, again -- Short ane sweet




 On Fri, 23 Mar 2001, Sundar @eSaravana wrote:

  Since nobody seemed to have read my long mail, I am re-writing my mail
short
  and probably sweet.
 
  Can I do, multilevel iteration with iterate tag.?
  For example:
  I have collection of beans in my session. In my JSP, I want to first
iterate
  at the collection to get the individual beans. And for every bean again
  iterate to get attributes/variables.

 There is no current mechanism to iterate over the properties of a bean
 (which is what I *think* you meant by attributes/variables).  However, if
 your bean had a method that returned all the interesting stuff as a Map or
 something like that, you could certainly have a nested iteration over
 that.

 For example, consider a bean that has a getter method:

 public Map getProperties();

 and you had a collection of them called "beans".  Then you can:

 logic:iterate id="bean" name="beans"
   Now processing bean bean:write name="bean" property="id"/
   logic:iterate id="property" name="bean" property="properties"
 Property bean:write name="property" property="key"/
 has value bean:write name="property" property="value"/
   /logic:iterate
 /logic:iterate


  Any help is deeply appreciated.
 
  Cheers...!
  Sundar
 
 

 Craig



 BuddyListForm.java


Re: Iterate Tag question, again -- Short ane sweet

2001-03-23 Thread Cecil Pang

How about using the tag

bean:define id="secondCollection" name="elementFromFirstColleciton" 
property="someCollecitonProperty" scope="session"/

to get a handle on the second collection and then literate on 
"secondCollection"


At 11:12 AM 3/23/2001 -0700, you wrote:
Since nobody seemed to have read my long mail, I am re-writing my mail short
and probably sweet.

Can I do, multilevel iteration with iterate tag.?
For example:
I have collection of beans in my session. In my JSP, I want to first iterate
at the collection to get the individual beans. And for every bean again
iterate to get attributes/variables.

Any help is deeply appreciated.

Cheers...!
Sundar





RE: Iterate Tag question, again -- Short ane sweet

2001-03-23 Thread Dorai, Harish (c)

I have employed multilevel iteration to display rows from a database, where
I iterate through the rows first and for each row iterate through the
columns to display the table. It should be possible in your case too. 

-Original Message-
From: Sundar @eSaravana [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 1:12 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Iterate Tag question, again -- Short ane sweet


Since nobody seemed to have read my long mail, I am re-writing my mail short
and probably sweet.

Can I do, multilevel iteration with iterate tag.?
For example:
I have collection of beans in my session. In my JSP, I want to first iterate
at the collection to get the individual beans. And for every bean again
iterate to get attributes/variables.

Any help is deeply appreciated.

Cheers...!
Sundar