Re: logic:iterate.. newbie question

2003-03-12 Thread Jamesey
thanks very much.. thats a great help..

"James Mitchell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Not exactly, if you had an ArrayList of String, you could don't need
> property.
> Like this:
>
> <%
> ArrayList lst = new ArrayList();
> lst.add("value 1");
> lst.add("value 2");
> lst.add("value 3");
> request.setAttribute("myCollection", lst);
> %>
>
> 
>  
> 
>
> --
> James Mitchell
> Software Developer/Struts Evangelist
> http://struts.sourceforge.net/struts-atlanta/
>
>
>
> > -Original Message-
> > From: Jamesey [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 12, 2003 10:18 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: logic:iterate.. newbie question
> >
> >
> > that helps massively.. and confirms my own deductions...
> >
> > and i'm assuming if i use an array of objects the name
> > property changed to
> > reflect the setAttribute name
> >
> > "James Mitchell" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > > -Original Message-
> > > > From: Jamesey [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, March 12, 2003 9:52 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: logic:iterate.. newbie question
> > > >
> > > >
> > > > I have and array or collection of objects (the object has two
> > > > members with
> > > > appropriate getter and setters)
> > > >
> > > > i want to iterate through the array and retrieve each
> > value for the
> > > > object..so it will look like this
> > > >
> > > > value a  valueb
> > > > value a  valueb
> > > > value a  valueb
> > > >
> > > > Question1. does the iteration object HAVE to be a bean? cant
> > > > it just be an
> > > > array of objects?
> > >
> > > No.  You could use an array of String or ArrayList of
> > Integer, whatever.
> > > The logic:iterate will look slightly different though.
> > >
> > >
> > > > Question2 how do you set up the iterate tag to get both values?
> > >
> > > You'll need to write them out using bean:write
> > >
> > > If you have a collection of bean:
> > > MyBean
> > >  String valueA;
> > >  String valueB;
> > >  (with getters and setters)
> > >
> > >
> > > Then you can display them as follows:
> > >
> > > (in your action)
> > >   //setup your collection
> > > ...
> > >   //then add to request
> > > request.setAttribute("myCollectionOfMyBean", coll);
> > >   // then forward to your jsp
> > >
> > >
> > > (in your jsp)
> > > 
> > >  
> > >  
> > > 
> > >
> > >
> > > See, the logic:iterate sets up a scripting variable named
> > 'itm' so that
> > > the bean:write tag can use it to call getValueA() and getValueB().
> > >
> > >
> > > HTH
> > >
> > > --
> > > James Mitchell
> > > Software Developer/Struts Evangelist
> > > http://struts.sourceforge.net/struts-atlanta/
> >
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >




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



RE: logic:iterate.. newbie question

2003-03-12 Thread James Mitchell
Not exactly, if you had an ArrayList of String, you could don't need
property.
Like this:

<%
ArrayList lst = new ArrayList();
lst.add("value 1");
lst.add("value 2");
lst.add("value 3");
request.setAttribute("myCollection", lst);
%>


 


--
James Mitchell
Software Developer/Struts Evangelist
http://struts.sourceforge.net/struts-atlanta/



> -Original Message-
> From: Jamesey [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 12, 2003 10:18 AM
> To: [EMAIL PROTECTED]
> Subject: Re: logic:iterate.. newbie question
> 
> 
> that helps massively.. and confirms my own deductions...
> 
> and i'm assuming if i use an array of objects the name 
> property changed to
> reflect the setAttribute name
> 
> "James Mitchell" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > -Original Message-
> > > From: Jamesey [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, March 12, 2003 9:52 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: logic:iterate.. newbie question
> > >
> > >
> > > I have and array or collection of objects (the object has two
> > > members with
> > > appropriate getter and setters)
> > >
> > > i want to iterate through the array and retrieve each 
> value for the
> > > object..so it will look like this
> > >
> > > value a  valueb
> > > value a  valueb
> > > value a  valueb
> > >
> > > Question1. does the iteration object HAVE to be a bean? cant
> > > it just be an
> > > array of objects?
> >
> > No.  You could use an array of String or ArrayList of 
> Integer, whatever.
> > The logic:iterate will look slightly different though.
> >
> >
> > > Question2 how do you set up the iterate tag to get both values?
> >
> > You'll need to write them out using bean:write
> >
> > If you have a collection of bean:
> > MyBean
> >  String valueA;
> >  String valueB;
> >  (with getters and setters)
> >
> >
> > Then you can display them as follows:
> >
> > (in your action)
> >   //setup your collection
> > ...
> >   //then add to request
> > request.setAttribute("myCollectionOfMyBean", coll);
> >   // then forward to your jsp
> >
> >
> > (in your jsp)
> > 
> >  
> >  
> > 
> >
> >
> > See, the logic:iterate sets up a scripting variable named 
> 'itm' so that
> > the bean:write tag can use it to call getValueA() and getValueB().
> >
> >
> > HTH
> >
> > --
> > James Mitchell
> > Software Developer/Struts Evangelist
> > http://struts.sourceforge.net/struts-atlanta/
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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



Re: logic:iterate.. newbie question

2003-03-12 Thread Jamesey
that helps massively.. and confirms my own deductions...

and i'm assuming if i use an array of objects the name property changed to
reflect the setAttribute name

"James Mitchell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > -Original Message-
> > From: Jamesey [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 12, 2003 9:52 AM
> > To: [EMAIL PROTECTED]
> > Subject: logic:iterate.. newbie question
> >
> >
> > I have and array or collection of objects (the object has two
> > members with
> > appropriate getter and setters)
> >
> > i want to iterate through the array and retrieve each value for the
> > object..so it will look like this
> >
> > value a  valueb
> > value a  valueb
> > value a  valueb
> >
> > Question1. does the iteration object HAVE to be a bean? cant
> > it just be an
> > array of objects?
>
> No.  You could use an array of String or ArrayList of Integer, whatever.
> The logic:iterate will look slightly different though.
>
>
> > Question2 how do you set up the iterate tag to get both values?
>
> You'll need to write them out using bean:write
>
> If you have a collection of bean:
> MyBean
>  String valueA;
>  String valueB;
>  (with getters and setters)
>
>
> Then you can display them as follows:
>
> (in your action)
>   //setup your collection
> ...
>   //then add to request
> request.setAttribute("myCollectionOfMyBean", coll);
>   // then forward to your jsp
>
>
> (in your jsp)
> 
>  
>  
> 
>
>
> See, the logic:iterate sets up a scripting variable named 'itm' so that
> the bean:write tag can use it to call getValueA() and getValueB().
>
>
> HTH
>
> --
> James Mitchell
> Software Developer/Struts Evangelist
> http://struts.sourceforge.net/struts-atlanta/




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



RE: logic:iterate.. newbie question

2003-03-12 Thread James Mitchell
> -Original Message-
> From: Jamesey [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 12, 2003 9:52 AM
> To: [EMAIL PROTECTED]
> Subject: logic:iterate.. newbie question
> 
> 
> I have and array or collection of objects (the object has two 
> members with
> appropriate getter and setters)
> 
> i want to iterate through the array and retrieve each value for the
> object..so it will look like this
> 
> value a  valueb
> value a  valueb
> value a  valueb
> 
> Question1. does the iteration object HAVE to be a bean? cant 
> it just be an
> array of objects?

No.  You could use an array of String or ArrayList of Integer, whatever.
The logic:iterate will look slightly different though.

 
> Question2 how do you set up the iterate tag to get both values?

You'll need to write them out using bean:write

If you have a collection of bean:
MyBean
 String valueA;
 String valueB; 
 (with getters and setters)


Then you can display them as follows:

(in your action)
  //setup your collection
...
  //then add to request
request.setAttribute("myCollectionOfMyBean", coll);
  // then forward to your jsp


(in your jsp)

 
 



See, the logic:iterate sets up a scripting variable named 'itm' so that
the bean:write tag can use it to call getValueA() and getValueB().


HTH

--
James Mitchell
Software Developer/Struts Evangelist
http://struts.sourceforge.net/struts-atlanta/


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



logic:iterate.. newbie question

2003-03-12 Thread Jamesey
I have and array or collection of objects (the object has two members with
appropriate getter and setters)

i want to iterate through the array and retrieve each value for the
object..so it will look like this

value a  valueb
value a  valueb
value a  valueb

Question1. does the iteration object HAVE to be a bean? cant it just be an
array of objects?

Question2 how do you set up the iterate tag to get both values?




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