You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Rasmussen <ss...@yahoo.com> on 2002/05/29 19:12:36 UTC

logic:iterate and multiple selections

Hi All,

I have an existing application that uses the logic:iterate
tag to display a table of editable/deletable "elements"
based on a collection of beans.  I have been tasked with
adding checkboxes to each row so that multiple selections
can be made and operated on (e.g. delete multiple elements
simultaneously rather than have to individually delete an
element).  

Is there a good example of this sort of thing somewhere? 
Short of that, am I on the right path in the assumption
that its the Indexed attribute that will be part of my
answer?  I was hoping the nightly build might have a good
example of how to use the indexed tag but I can't seem to
find any example of the use of the indexed tag in the
sample webapps shipped with it.

Any help greatly appreciated.

Thanks.

Dan Rasmussen


=====
------ replies to sscanf@yahoo.com ------

Anything that appears after this sentence is inserted by 
Yahoo (or others) and may not be a good idea.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Keyboard Monkey question

Posted by Arron Bates <ar...@keyboardmonkey.com>.
>
>
>To put it in a different way, how would I call
>setMokeyTeamAlpha() from MonkeyStruts_v2.jsp if I had a
>MonkeyTeamBean in the session that I wanted to use instead
>of the sample provided in the constructor for
>BananasIncorporatedBean?
>

In the JSP or your action?... In your action you can just call the 
setMonkeyTeam() method and pass it your collection.

If you don't want to work over the form bean, you can point a 
<nested:root> tag at a bean and just use that.

For example, say you have a bean name "theMonkeys" in your session which 
holds your collection, you can simply use the following to iterate...

<nested:root name="theMonkeys">
<nested:iterate property="monkeyCollection">
[...]
</nested:iterate>
</nested:root>

But to actually put the collection into the form bean in the JSP itself 
would require a scriptlet. Rather than this, I'd recommend doing it in 
the action, or iterating over the separate bean like above.

Did you try the tutorials on the keyboardmonkey site?...

I'm in the middle of a blurbish page of how to create nested lists etc 
with no logic in the constructors or holding the beans in session.

Hope this gets you a little closer to the target, if not, you know where 
we are :)


Arron.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Keyboard Monkey question

Posted by Dan Rasmussen <ss...@yahoo.com>.
In response to my recent logic:iterate question, Aaron
Bates suggested I look into nested tags and pointed me at
his wicked cool keyboard monkey example: 

http://www.keyboardmonkey.com/next

Thanks to Aaron for pointing me to it.  I have been looking
at the monkey code and am attempting to refit my app with
the nested tags based on my reading of it. I have a
question to those that might be familiar with this example.
 [ I e-mailed directly to Aaron but I'm not sure he'll be
able to get to it right away and there is some breathing on
going on down my neck. ]

I'm having a little trouble finding my way through one
aspect that isn't covered in the monkey code.  I have an
existing collection of beans that come out of the session
and were used with the logic:iterate tag.  In this case,
when I hit my action.perform, the form has been
instantiated and populated with the values from a bean from
the collection. 

In the monkey example, the beans/collections are mingled
with the form. I understand this but I don't understand how
to call the setter in the Form class to point it at the
collection of beans I was previously iterating on.  I have
implemented the setter (and wrapped my collection in a
separate class which exposes the collection as an array. 
I'm just not sure how to call the setter from my jsp prior
to getting to the nested:iterate loop (I tried
nested:hidden but have been having problems).  The monkey
example is using the constructors to do the initialization
which I am unable to do.

To put it in a different way, how would I call
setMokeyTeamAlpha() from MonkeyStruts_v2.jsp if I had a
MonkeyTeamBean in the session that I wanted to use instead
of the sample provided in the constructor for
BananasIncorporatedBean?

Thanks for the help.

Dan

--- Arron Bates <ar...@pacific.net.au> wrote:
> Indexed options in the tag is one way to get it done, but
> it's not the 
> easiest.
> 
> Here's a previous post where I put up a quick example of
> doing without 
> nested tags, and with the nested tags...
>     
>
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg31991.html
> 
> And if you have Struts 1.1b, then you already have the
> nested tags.
> 
> 
> Running example of delete/add functionality using the
> nested tags...
>    
>
http://www.keyboardmonkey.com/StrutMonkey/MonkeyStruts_v2.jsp
> 
> Primer and tutorials on the tags are here...
>     http://www.keyboardmonkey.com/next
> 
> For older Struts versions the above site has the jar of
> just the tags.
> 
> 
> Arron.
> 
> 
> Dan Rasmussen wrote:
> 
> >Hi All,
> >
> >I have an existing application that uses the
> logic:iterate
> >tag to display a table of editable/deletable "elements"
> >based on a collection of beans.  I have been tasked with
> >adding checkboxes to each row so that multiple
> selections
> >can be made and operated on (e.g. delete multiple
> elements
> >simultaneously rather than have to individually delete
> an
> >element).  
> >
> >Is there a good example of this sort of thing somewhere?
> 
> >Short of that, am I on the right path in the assumption
> >that its the Indexed attribute that will be part of my
> >answer?  I was hoping the nightly build might have a
> good
> >example of how to use the indexed tag but I can't seem
> to
> >find any example of the use of the indexed tag in the
> >sample webapps shipped with it.
> >
> >Any help greatly appreciated.
> >
> >Thanks.
> >
> >Dan Rasmussen
> >
> >
> >=====
> >------ replies to sscanf@yahoo.com ------
> >
> >Anything that appears after this sentence is inserted by
> 
> >Yahoo (or others) and may not be a good idea.
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! - Official partner of 2002 FIFA World Cup
> >http://fifaworldcup.yahoo.com
> >
> >--
> >To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
------ replies to sscanf@yahoo.com ------

Anything that appears after this sentence is inserted by 
Yahoo (or others) and may not be a good idea.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate and multiple selections

Posted by Arron Bates <ar...@pacific.net.au>.
Indexed options in the tag is one way to get it done, but it's not the 
easiest.

Here's a previous post where I put up a quick example of doing without 
nested tags, and with the nested tags...
    
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg31991.html

And if you have Struts 1.1b, then you already have the nested tags.


Running example of delete/add functionality using the nested tags...
    http://www.keyboardmonkey.com/StrutMonkey/MonkeyStruts_v2.jsp

Primer and tutorials on the tags are here...
    http://www.keyboardmonkey.com/next

For older Struts versions the above site has the jar of just the tags.


Arron.


Dan Rasmussen wrote:

>Hi All,
>
>I have an existing application that uses the logic:iterate
>tag to display a table of editable/deletable "elements"
>based on a collection of beans.  I have been tasked with
>adding checkboxes to each row so that multiple selections
>can be made and operated on (e.g. delete multiple elements
>simultaneously rather than have to individually delete an
>element).  
>
>Is there a good example of this sort of thing somewhere? 
>Short of that, am I on the right path in the assumption
>that its the Indexed attribute that will be part of my
>answer?  I was hoping the nightly build might have a good
>example of how to use the indexed tag but I can't seem to
>find any example of the use of the indexed tag in the
>sample webapps shipped with it.
>
>Any help greatly appreciated.
>
>Thanks.
>
>Dan Rasmussen
>
>
>=====
>------ replies to sscanf@yahoo.com ------
>
>Anything that appears after this sentence is inserted by 
>Yahoo (or others) and may not be a good idea.
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! - Official partner of 2002 FIFA World Cup
>http://fifaworldcup.yahoo.com
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>