You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@sixty4bit.com on 2003/03/12 22:10:04 UTC

ArrayList & Object[] funkiness

One of our Form's has an ArrayList property.  The getter method for that 
property returns an Object[].  That functionality no longer works on my 
development machine (it does work on the production server).  If I change the 
return type to ArrayList it then works on my development machine but no longer 
works in production.  What I don't understand is, this is all packaged up in a 
war file being deployed to the same version of WebLogic, with the same 
settings, same JVM, same everthing.

My questions are:  

Which is the correct return type for use with logic:iterate ArrayList or 
Object[]?

Any guesses to what may be causing this to happen?

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by st...@sixty4bit.com.
Rick, Thanks for your help.  The difference between the two machines is the big 
question because if they are different, it will be in some obscure fractional 
way.  They are both hitting the same database, using the same version of 
WebLogic, different OS's (Windows 2k vs WindowsXP), same JVM, EVEN the same war 
file!  The exact same war file works on one machine but not the other.  I am 
living in the Twilight Zone and I have no idea how I got there...  Anyway, 
thanks for your help.  I will figure this out somehow...


Carl

Quoting Rick Reumann <r...@reumann.net>:

> On Wed, 12 Mar 2003 16:59:31 -0600
> struts@sixty4bit.com wrote:
>  
> > The above causes the app to work on my machine, and break on everyone
> > elses.
> 
> So of course the obvious question- what is different about the two
> machines? Are they accessing the same exact information that is
> populating the collection/array? 
> 
> >  
> > > Also in your code what is the Collection or array holding? In other
> > > words I take it "group" is the name of some Collection of objects
> > > where each of the objects in there has a property called "name" ?
> > > 
> > > <nested:root>
> > >   <nested:iterate property="group" id="g">  
> > >     <nested:write property="name">       
> > >   </nested:iterate>
> > > </nested:root>
> > > 
> > 
> > The form's that are in a group are just normal ActionForm's.  They
> > have a name and an id and there is some linking done, but it is all
> > independant of the ArrayList / Object[] issue.   
> 
> Sorry maybe I wasn't clear, I'm just trying to figure out what is being
> stored in the Collection called "group." The way it's set up above
> "group" should be a collection of some beans where each bean in group at
> least has one field named "name" (with the appropriate getter
> obviously).
> 
> I'm still more stumped on why it would be working on your machine and
> not the others... different jars in lib? Different tlds? Something is
> freaky there for sure. I'd stick with using a Collection though for your
> iterate and work on narrowing down what is enabling it work on one box
> and not another. 
> 
> -- 
> Rick Reumann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by Rick Reumann <r...@reumann.net>.
On Wed, 12 Mar 2003 16:59:31 -0600
struts@sixty4bit.com wrote:
 
> The above causes the app to work on my machine, and break on everyone
> elses.

So of course the obvious question- what is different about the two
machines? Are they accessing the same exact information that is
populating the collection/array? 

>  
> > Also in your code what is the Collection or array holding? In other
> > words I take it "group" is the name of some Collection of objects
> > where each of the objects in there has a property called "name" ?
> > 
> > <nested:root>
> >   <nested:iterate property="group" id="g">  
> >     <nested:write property="name">       
> >   </nested:iterate>
> > </nested:root>
> > 
> 
> The form's that are in a group are just normal ActionForm's.  They
> have a name and an id and there is some linking done, but it is all
> independant of the ArrayList / Object[] issue.   

Sorry maybe I wasn't clear, I'm just trying to figure out what is being
stored in the Collection called "group." The way it's set up above
"group" should be a collection of some beans where each bean in group at
least has one field named "name" (with the appropriate getter
obviously).

I'm still more stumped on why it would be working on your machine and
not the others... different jars in lib? Different tlds? Something is
freaky there for sure. I'd stick with using a Collection though for your
iterate and work on narrowing down what is enabling it work on one box
and not another. 

-- 
Rick Reumann

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by st...@sixty4bit.com.
Answers below...
> 
> What happens when you have:
> 
> ArrayList group;
> 
> public ArrayList getGroup() {
>    return group;
> }

The above causes the app to work on my machine, and break on everyone elses.
 
> Also in your code what is the Collection or array holding? In other
> words I take it "group" is the name of some Collection of objects where
> each of the objects in there has a property called "name" ?
> 
> <nested:root>
>   <nested:iterate property="group" id="g">  
>     <nested:write property="name">       
>   </nested:iterate>
> </nested:root>
> 

The form's that are in a group are just normal ActionForm's.  They have a name 
and an id and there is some linking done, but it is all independant of the 
ArrayList / Object[] issue.   
 
> 
> -- 
> Rick Reumann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by Rick Reumann <r...@reumann.net>.
On Wed, 12 Mar 2003 16:24:32 -0600
struts@sixty4bit.com wrote:

> How about the important snippets :)
> 
> In the Form:
> public Object[] getGroup()
> {
>    return group.toArray();
> }

What happens when you have:

ArrayList group;

public ArrayList getGroup() {
   return group;
}

Also in your code what is the Collection or array holding? In other
words I take it "group" is the name of some Collection of objects where
each of the objects in there has a property called "name" ?

<nested:root>
  <nested:iterate property="group" id="g">  
    <nested:write property="name">       
  </nested:iterate>
</nested:root>



-- 
Rick Reumann

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by st...@sixty4bit.com.
How about the important snippets :)

In the Form:
public Object[] getGroup()
{
   return group.toArray();
}

In the jsp:
<nested:root>
   <nested:iterate property="group" id="g"> // this is the line that dies
       <nested:write property="name">
       // .... other writes and fun things
   </nested:iterate>
</nested:root>


Quoting Rick Reumann <r...@reumann.net>:

> On Wed, 12 Mar 2003 15:48:58 -0600
> struts@sixty4bit.com wrote:
> 
> > So, if the ArrayList is the right way to go...  Why does it explode in
> > the majority of the environments (all developers except for me, and
> > all servers) and Object[] works?  
> 
> Very odd.  Before switching to JSTL for tag, I used Collections all the
> time in iterate. 
> 
> Maybe you could post the exact form bean definition and the iterate
> portion of you code in the jSP. 
> 
> -- 
> Rick Reumann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by Rick Reumann <r...@reumann.net>.
On Wed, 12 Mar 2003 15:48:58 -0600
struts@sixty4bit.com wrote:

> So, if the ArrayList is the right way to go...  Why does it explode in
> the majority of the environments (all developers except for me, and
> all servers) and Object[] works?  

Very odd.  Before switching to JSTL for tag, I used Collections all the
time in iterate. 

Maybe you could post the exact form bean definition and the iterate
portion of you code in the jSP. 

-- 
Rick Reumann

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by st...@sixty4bit.com.
So, if the ArrayList is the right way to go...  Why does it explode in the 
majority of the environments (all developers except for me, and all servers) 
and Object[] works?  Using Struts 1.1B2.  Servers: Solaris, Dev boxes: Windows, 
AppServer: WebLogic.

Carl

Quoting Rick Reumann <r...@reumann.net>:

> On Wed, 12 Mar 2003 16:25:08 -0500
> "Mark Galbreath" <ma...@qat.com> wrote:
> 
> > ArrayList; if you return Object[] you will have to cast it into an
> > ArrayList.
> 
> I know you know this Mark, but just to be a bit more technically correct
> in case struts@sixty4bit.com isn't aware, any of the Collection classes
> including the base class Collection should work I believe with iterate
> (it doesn't have to be just type ArrayList... although I find myself
> using that one the most often).
> 
> 
> -- 
> Rick Reumann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ArrayList & Object[] funkiness

Posted by Rick Reumann <r...@reumann.net>.
On Wed, 12 Mar 2003 16:25:08 -0500
"Mark Galbreath" <ma...@qat.com> wrote:

> ArrayList; if you return Object[] you will have to cast it into an
> ArrayList.

I know you know this Mark, but just to be a bit more technically correct
in case struts@sixty4bit.com isn't aware, any of the Collection classes
including the base class Collection should work I believe with iterate
(it doesn't have to be just type ArrayList... although I find myself
using that one the most often).


-- 
Rick Reumann

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: ArrayList & Object[] funkiness

Posted by Mark Galbreath <ma...@qat.com>.
ArrayList; if you return Object[] you will have to cast it into an
ArrayList.

Mark

-----Original Message-----
From: struts@sixty4bit.com [mailto:struts@sixty4bit.com] 
Sent: Wednesday, March 12, 2003 4:10 PM

One of our Form's has an ArrayList property.  The getter method for that 
property returns an Object[].  That functionality no longer works on my 
development machine (it does work on the production server).  If I change
the 
return type to ArrayList it then works on my development machine but no
longer 
works in production.  What I don't understand is, this is all packaged up in
a 
war file being deployed to the same version of WebLogic, with the same 
settings, same JVM, same everthing.

My questions are:  

Which is the correct return type for use with logic:iterate ArrayList or 
Object[]?

Any guesses to what may be causing this to happen?



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org