Nested logic:iterate tags will not compile at runtime.

2002-11-19 Thread Billy Bacon
I'm having a problem with embedding 2 logic:iterate tags together. I need to produce 
results that would be similar to having a nested for loop. I've looked at the 
nested:iterate tag but I can't seem to get it to work or if I'm even supposed to be 
referencing this tag for this issue. I *don't* need to reference the 'parent' iterate 
tag. Here is a code snippet of what I'm looking to do:

logic:iterate id=outterloop name=bean property=someList

Next element is bean:write name=outterloop /

 logic:iterate id=innerLoop name=bean property=someOtherList
  bean:write name=innerLoop /
 /logic:iterate

/logic:iterate


There's some HTML that goes along with this code but I left that out for simplicity. 
My problem is that when I try to request the JSP with the code above, it won't even 
compile. It doesn't like that there is an logic:iterate tag nested within another. 
Has anyone ever come across this error before?

Any help on this would be greatly appreciated.

- Billy -



RE: Nested logic:iterate tags ServletExec

2001-06-07 Thread Roman Fail

I can second your problems with nested iterate tags using ServletExec.
We are running JDK 1.3, ServletExec 3.1, Win2k/IIS 5.0.  I posted
something about it a few weeks ago but no one replied.  It appeared to
me to be some sort of recursion issue, where the body of the inner
iterate tag was evaluated and output prior to the outer iterate tag.  We
ended up just using a scriplet for the outer loop and an iterate tag for
the inner loop.  I havent' seen any other glaring problems with the
custom tags running under ServletExecyet.
 
ServletExec 4.0 is in beta right now, perhaps that will solve the
problem?  It's supposed to support Servlet API 2.3 and JSP 1.2 (as soon
as they are released!).
 
Roman
 

-Original Message- 
From: Amos Shapira 
Sent: Wed 6/6/2001 8:58 AM 
To: '[EMAIL PROTECTED]' 
Cc: 
Subject: RE: Nested logic:iterate tags



Hi,

I just had bad experience with ServletExec 3.0E and nested
iterate tags.  When I changed the inner iterate tag back to
scriptlets things startted working again (the code worked fine
under Tomcat 3.2.1).

Is anyone aware of problems with NewAtlanta's handling of custom
tags in general or Struts in particular?

My env:

1. Sun JDK 1.2.2_5/6
2. New Atlanta ServletExec 3.0E
3. Windows 2000 Professional or Sparc Solaris 2.6
4. Jakarta Struts and Jakarta Taglib

Thanks,

--Amos




 winmail.dat


Re: Nested logic:iterate tags ServletExec

2001-06-07 Thread Ted Husted

Be sure to report this to your vendor; people are starting to use Struts
as a compatibility test of their containers with the specifications ;-)

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Roman Fail wrote:
 
 I can second your problems with nested iterate tags using ServletExec.
 We are running JDK 1.3, ServletExec 3.1, Win2k/IIS 5.0.  I posted
 something about it a few weeks ago but no one replied.  It appeared to
 me to be some sort of recursion issue, where the body of the inner
 iterate tag was evaluated and output prior to the outer iterate tag.  We
 ended up just using a scriplet for the outer loop and an iterate tag for
 the inner loop.  I havent' seen any other glaring problems with the
 custom tags running under ServletExecyet.
 
 ServletExec 4.0 is in beta right now, perhaps that will solve the
 problem?  It's supposed to support Servlet API 2.3 and JSP 1.2 (as soon
 as they are released!).
 
 Roman
 
 
 -Original Message-
 From: Amos Shapira
 Sent: Wed 6/6/2001 8:58 AM
 To: '[EMAIL PROTECTED]'
 Cc:
 Subject: RE: Nested logic:iterate tags
 
 
 
 Hi,
 
 I just had bad experience with ServletExec 3.0E and nested
 iterate tags.  When I changed the inner iterate tag back to
 scriptlets things startted working again (the code worked fine
 under Tomcat 3.2.1).
 
 Is anyone aware of problems with NewAtlanta's handling of custom
 tags in general or Struts in particular?
 
 My env:
 
 1. Sun JDK 1.2.2_5/6
 2. New Atlanta ServletExec 3.0E
 3. Windows 2000 Professional or Sparc Solaris 2.6
 4. Jakarta Struts and Jakarta Taglib
 
 Thanks,
 
 --Amos
 
 
 
   
   Name: winmail.dat
winmail.datType: application/ms-tnef
   Encoding: base64



Nested logic:iterate tags

2001-06-06 Thread Marc S. Penner

Is it possible to nest logic:iterate tags?  I would prefer not to try to
spend too much time trying to do something that isn't possible.

Marc


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: Nested logic:iterate tags

2001-06-06 Thread Marc S. Penner

Apparently, it is.  I tried it and it worked quite easily.  Answered my own
question.

Marc

- Original Message -
From: Marc S. Penner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 06, 2001 10:32 AM
Subject: Nested logic:iterate tags


 Is it possible to nest logic:iterate tags?  I would prefer not to try to
 spend too much time trying to do something that isn't possible.

 Marc


 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




RE: Nested logic:iterate tags

2001-06-06 Thread Charlesworth, Chico


yes it is possible, like so:

logic:iterate id=firstListElement name=firstList

logic:iterate id=secondListElement namesecondList

bean:write name=firstListElement
bean:write name=secondListElement

/logic:iterate

/logic:iterate

-Original Message-
From: Marc S. Penner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 06, 2001 3:33 PM
To: [EMAIL PROTECTED]
Subject: Nested logic:iterate tags


Is it possible to nest logic:iterate tags?  I would prefer not to try to
spend too much time trying to do something that isn't possible.

Marc


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England  Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS



RE: Nested logic:iterate tags

2001-06-06 Thread Jon.Ridgway

Hi Marc,

Yes its possible, search the archive as I believe an example has been
posted. See http://www.mail-archive.com/struts-user@jakarta.apache.org/

Jon.

-Original Message-
From: Marc S. Penner [mailto:[EMAIL PROTECTED]] 
Sent: 06 June 2001 15:33
To: [EMAIL PROTECTED]
Subject: Nested logic:iterate tags

Is it possible to nest logic:iterate tags?  I would prefer not to try to
spend too much time trying to do something that isn't possible.

Marc


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



Re: Nested logic:iterate tags

2001-06-06 Thread jdware

Marc,
Here's a sample of nested iterate tags IterateForm.java and
TimeNavDblIter.jsp.
Thanks to Craig et al  it's a piece of cake.


john ware



/   TimeNavDblIter.jsp



!doctype html public -//w3c//dtd html 4.0 transitional//en
%@ page language=java import = com.jdware.beans.* %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
html:html


%
IterateForm instance = new IterateForm();
instance.setName( yeh baby );

 pageContext.setAttribute(instance, instance,
PageContext.PAGE_SCOPE);


%
html:form action=/time 


Name: bean:write name=instance property='%= name %' filter=true
/br/
Address  bean:write name=instance property='%= address %'
filter=true /br/
table border=1 width=100%
  trthType/ththSize/th
% int h = 0; %
logic:iterate name=instance property='%= foos[0].bars %'
id=anything
  th
bean:write name=instance property='%= foos[0].bars[ + h +
].date %' filter=true /
  /th
  % h++; %
/logic:iterate
  /tr
  tr
% int i = 0; %
  logic:iterate name=instance property=foos id=anything
  tr
td
  bean:write name=instance property='%= foos[ + i + ].type
%' filter=true /
/td
td
  bean:write name=instance property='%= foos[ + i + ].size
%' filter=true /
/td

  % int j = 0; %
  logic:iterate name=instance property='%= foos[ + i + ].bars
%'  id=anything
td
  html:text name=instance property='%= foos[ + i + ].bars[ +
j + ].hours %' filter=true /
/td
% j++; %
  /logic:iterate
  /tr
% i++; %
/logic:iterate

  /table
   html:submit/
/html:form
/html:html

//  end
TimeNavDblIter.jsp

// IterateForm.java

package com.jdware.beans;


import java.util.*;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import com.jdware.util.Trace;


public class IterateForm  extends ActionForm {

public String name = TestMe;
public String address = Sischo Dr;
public IterateForm(){
foos = Foo.getFoosByMagic();
}

public static class Foo implements Comparable {
public String type;
public int size;
public Foo(){
type=foo;
size=0;
bars = Bar.getBarsByMagic();
}
public Foo( String type, int size ){
bars = Bar.getBarsByMagic();
this.type = type;
this.size = size;
}
public static ArrayList getFoosByMagic(){
ArrayList rtn = new ArrayList();
rtn.add( new Foo(typeA, 42));
rtn.add( new Foo(typeF, 2));
rtn.add( new Foo(typeW, 4));
rtn.add( new Foo(typeH, 0));
rtn.add( new Foo(typeX, 77));

return rtn;
}
public String getType(){return type;}
public void setType( String type ){ this.type = type; }

public int getSize(){ return size; }
public void setSize( int size ){ this.size = size; }
public int compareTo(Object o){
return type.compareTo( ((Foo)o).type );
}
public static class Bar implements Comparable{
/**
 *
 */
public String date;
public String getDate(){ return date; }
public void setDate( String date ){ this.date = date; }
/**
 *
 */
public String activity;
public String getActivity(){ return activity; }
public void setActivity( String activity ){ this.activity =
activity; }

/**
 *
 */
public double hours;
public double getHours(){ return hours; }
public void   setHours( double hours ) { this.hours = hours; }

public Bar(){
date = 8/5/50;
activity = nonsense;
hours = 8.5;
}
public Bar( String date, String activity, double hours ){
this.date = date;
this.activity = activity;
this.hours = hours;
}
public static ArrayList getBarsByMagic(){
ArrayList rtn = new ArrayList();
rtn.add( new Bar(4/3/54, chores, 8.5));
rtn.add( new Bar(2/5/85, hotguys, 0.5));
rtn.add( new Bar(6/4/88, battle, 3.5));
rtn.add( new Bar(8/5/50, fun, 18.5));
return rtn;
}
public int compareTo(Object o){
return date.compareTo( ((Bar)o).date );
}

RE: Nested logic:iterate tags

2001-06-06 Thread Amos Shapira

Hi,

I just had bad experience with ServletExec 3.0E and nested
iterate tags.  When I changed the inner iterate tag back to
scriptlets things startted working again (the code worked fine
under Tomcat 3.2.1).

Is anyone aware of problems with NewAtlanta's handling of custom
tags in general or Struts in particular?

My env:

1. Sun JDK 1.2.2_5/6
2. New Atlanta ServletExec 3.0E
3. Windows 2000 Professional or Sparc Solaris 2.6
4. Jakarta Struts and Jakarta Taglib

Thanks,

--Amos

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 06, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: Re: Nested logic:iterate tags


Marc,
Here's a sample of nested iterate tags IterateForm.java and
TimeNavDblIter.jsp.
Thanks to Craig et al  it's a piece of cake.


john ware



/   TimeNavDblIter.jsp



!doctype html public -//w3c//dtd html 4.0 transitional//en
%@ page language=java import = com.jdware.beans.* %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
html:html


%
IterateForm instance = new IterateForm();
instance.setName( yeh baby );

 pageContext.setAttribute(instance, instance,
PageContext.PAGE_SCOPE);


%
html:form action=/time 


Name: bean:write name=instance property='%= name %' filter=true
/br/
Address  bean:write name=instance property='%= address %'
filter=true /br/
table border=1 width=100%
  trthType/ththSize/th
% int h = 0; %
logic:iterate name=instance property='%= foos[0].bars %'
id=anything
  th
bean:write name=instance property='%= foos[0].bars[ + h +
].date %' filter=true /
  /th
  % h++; %
/logic:iterate
  /tr
  tr
% int i = 0; %
  logic:iterate name=instance property=foos id=anything
  tr
td
  bean:write name=instance property='%= foos[ + i + ].type
%' filter=true /
/td
td
  bean:write name=instance property='%= foos[ + i + ].size
%' filter=true /
/td

  % int j = 0; %
  logic:iterate name=instance property='%= foos[ + i + ].bars
%'  id=anything
td
  html:text name=instance property='%= foos[ + i + ].bars[ +
j + ].hours %' filter=true /
/td
% j++; %
  /logic:iterate
  /tr
% i++; %
/logic:iterate

  /table
   html:submit/
/html:form
/html:html

//  end
TimeNavDblIter.jsp

// IterateForm.java

package com.jdware.beans;


import java.util.*;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import com.jdware.util.Trace;


public class IterateForm  extends ActionForm {

public String name = TestMe;
public String address = Sischo Dr;
public IterateForm(){
foos = Foo.getFoosByMagic();
}

public static class Foo implements Comparable {
public String type;
public int size;
public Foo(){
type=foo;
size=0;
bars = Bar.getBarsByMagic();
}
public Foo( String type, int size ){
bars = Bar.getBarsByMagic();
this.type = type;
this.size = size;
}
public static ArrayList getFoosByMagic(){
ArrayList rtn = new ArrayList();
rtn.add( new Foo(typeA, 42));
rtn.add( new Foo(typeF, 2));
rtn.add( new Foo(typeW, 4));
rtn.add( new Foo(typeH, 0));
rtn.add( new Foo(typeX, 77));

return rtn;
}
public String getType(){return type;}
public void setType( String type ){ this.type = type; }

public int getSize(){ return size; }
public void setSize( int size ){ this.size = size; }
public int compareTo(Object o){
return type.compareTo( ((Foo)o).type );
}
public static class Bar implements Comparable{
/**
 *
 */
public String date;
public String getDate(){ return date; }
public void setDate( String date ){ this.date = date; }
/**
 *
 */
public String activity;
public String getActivity(){ return activity; }
public void setActivity( String activity ){ this.activity =
activity; }

/**
 *
 */
public double hours;
public double getHours(){ return hours; }
public void   setHours( double hours ) { this.hours = hours; }

public Bar(){
date = 8/5/50;
activity = nonsense;
hours = 8.5;
}
public Bar

nested logic:iterate tags

2001-05-03 Thread Richard Murray

Hi, 

I'm trying to generate a table of data from a 2 dimensional array of Strings
called ( String[][] data ).  I am trying to use the struts tag
logic:iterate to loop through the data and generate the table.  As it is a
2 dimensional array I have nested the iterate statements as follows:

struts_logic:iterate id=rows name=contributorList property=data
scope=page
struts_logic:iterate id=data collection=(Object[])rows
tdstruts_bean:write name=data//td

/struts_logic:iterate
/struts_logic:iterate

I get the following exception trying to run this:

org.apache.jasper.compiler.CompileException:
F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String to
java.lang.Object for attribute collection 

I'm trying to use the id (rows) from the first iterate statement as a
variable in the second, however it seems it looks as though it is being
treated as a string rather than a variable.  I thought the id held the
current object in the iteration, which in my case is an array.

Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
done something obviously wrong.

Thanks.
 
Richard Murray 
Software Engineer - Net Products Development 
QSP
OLAS House, Team Valley Trading Estate,
5th Avenue Business Park,
Gateshead, Tyne  Wear NE11 0XA  
Switchboard+44 (0) 191 402  
Direct line   +44 (0) 191 402 3329 
email  [EMAIL PROTECTED] 
website   www.qspgroup.com 
QSP - Enabling e-Finance 




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: nested logic:iterate tags

2001-05-03 Thread Richard Murray

Hi, 

For anyone interested I managed fix my problem with the following:

struts_logic:iterate id=rows name=contributorList property=data
scope=page
tr
struts_logic:iterate id=element name=rows
tdstruts_bean:write name=element//td

/struts_logic:iterate
/tr
/struts_logic:iterate

Regards

Richard

-Original Message-
From: Richard Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 2:44 PM
To: '[EMAIL PROTECTED]'
Subject: nested logic:iterate tags


Hi, 

I'm trying to generate a table of data from a 2 dimensional array of Strings
called ( String[][] data ).  I am trying to use the struts tag
logic:iterate to loop through the data and generate the table.  As it is a
2 dimensional array I have nested the iterate statements as follows:

struts_logic:iterate id=rows name=contributorList property=data
scope=page
struts_logic:iterate id=data collection=(Object[])rows
tdstruts_bean:write name=data//td

/struts_logic:iterate
/struts_logic:iterate

I get the following exception trying to run this:

org.apache.jasper.compiler.CompileException:
F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String to
java.lang.Object for attribute collection 

I'm trying to use the id (rows) from the first iterate statement as a
variable in the second, however it seems it looks as though it is being
treated as a string rather than a variable.  I thought the id held the
current object in the iteration, which in my case is an array.

Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
done something obviously wrong.

Thanks.
 
Richard Murray 
Software Engineer - Net Products Development 
QSP
OLAS House, Team Valley Trading Estate,
5th Avenue Business Park,
Gateshead, Tyne  Wear NE11 0XA  
Switchboard+44 (0) 191 402  
Direct line   +44 (0) 191 402 3329 
email  [EMAIL PROTECTED] 
website   www.qspgroup.com 
QSP - Enabling e-Finance 




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: nested logic:iterate tags

2001-05-03 Thread tpeters

Richard,

What does the array look like? Can you post the logic for that array?

On Thu, 03 May 2001, Richard Murray wrote:

 
 Hi, 
 
 For anyone interested I managed fix my problem with the following:
 
 struts_logic:iterate id=rows name=contributorList property=data
 scope=page
 tr
 struts_logic:iterate id=element name=rows
 tdstruts_bean:write name=element//td
 
 /struts_logic:iterate
 /tr
 /struts_logic:iterate
 
 Regards
 
 Richard
 
 -Original Message-
 From: Richard Murray [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 03, 2001 2:44 PM
 To: '[EMAIL PROTECTED]'
 Subject: nested logic:iterate tags
 
 
 Hi, 
 
 I'm trying to generate a table of data from a 2 dimensional array of Strings
 called ( String[][] data ).  I am trying to use the struts tag
 logic:iterate to loop through the data and generate the table.  As it is a
 2 dimensional array I have nested the iterate statements as follows:
 
 struts_logic:iterate id=rows name=contributorList property=data
 scope=page
 struts_logic:iterate id=data collection=(Object[])rows
 tdstruts_bean:write name=data//td
 
 /struts_logic:iterate
 /struts_logic:iterate
 
 I get the following exception trying to run this:
 
 org.apache.jasper.compiler.CompileException:
 F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String to
 java.lang.Object for attribute collection 
 
 I'm trying to use the id (rows) from the first iterate statement as a
 variable in the second, however it seems it looks as though it is being
 treated as a string rather than a variable.  I thought the id held the
 current object in the iteration, which in my case is an array.
 
 Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
 done something obviously wrong.
 
 Thanks.
  
 Richard Murray 
 Software Engineer - Net Products Development 
 QSP
 OLAS House, Team Valley Trading Estate,
 5th Avenue Business Park,
 Gateshead, Tyne  Wear NE11 0XA  
 Switchboard+44 (0) 191 402  
 Direct line   +44 (0) 191 402 3329 
 email  [EMAIL PROTECTED] 
 website   www.qspgroup.com 
 QSP - Enabling e-Finance 
 
 
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager at [EMAIL PROTECTED]
 
 This footnote also confirms that this email message has been swept by
 for the presence of computer viruses.
 
 http://www.qspgroup.com
 **

Thomas Peters

Senior Software Engineer
Aidera Solutions

Cell: 603-566-5406
Voice Mail: 603-888-7700