Re: Iterate over list in in list in form bean.

2005-07-18 Thread Rick Reumann

Mike Elliott wrote the following on 7/18/2005 3:18 PM:


I came up with another solution which might be worthy of
consideration.  Instead of using arrays, extend a list with the
desired get( int ) method and use that list instead:

 public class SkillActionForm extends ActionForm {

  protected List skills = new LazyArrayList();

  public class LazyArrayList extends ArrayList {
 public Object get( int index ) {
while (size() <= index) add( new SkillBean()  );
return super.get( index );
 }
  }
  }

This is the solution I eventually adopted (successfully) but I have a
fondness for nested classes which others may not share.


I'm pretty sure what LazyList is doing similar stuff in the background, 
so I'm curious why you don't just use that?


http://wiki.apache.org/struts/StrutsCatalogLazyList

--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Andrew Tomaka
I've stumbled across a similar problem that I'm trying to find the
Struts solution for.

I have a form which allows users to add a dynamic amount of rows (via
a button that says "Add Row") and then submit the form with as little
or many rows as they wish.  Can a form bean be setup using collections
instead of other object types?  What is the proper way to handle a
dynamic amount of the same data coming in to a Action?

~ Andrew Tomaka

On 7/18/05, Rick Reumann <[EMAIL PROTECTED]> wrote:
> Mike Elliott wrote the following on 7/18/2005 10:55 AM:
> 
> > I've been beating my head against this all weekend to no avail.  I
> > understand how to do this in session scope, but don't know if it's
> > even possible in request scope.
> >
> > As I understand things (which may be wrong), when the form is
> > submitted (in request scope) a new form bean is created and populated
> > with the values in the collection from the HTML form.  But, of course,
> > a newly created form won't know how many elements are in the form so
> > it can't pre-populate the collection with beans to be filled in.
> > Right?
> 
> I'm still not totally clear where the problem is, since I'm not sure
> what Session has to do with the initial setup of the form. It might help
> if you let us know what the exact problem is when using request scope...
> 
> 1) A problem when you submit the form and getting 'index' problems
> showing up in the logs?
> 
> 2) Is it making sure the nested structure is still there when validation
> fails?
> 
> I'm confused because you mention "But, of course, a newly created form
> won't know how many elements are in the form so it can't pre-populate
> the collection with beans to be filled in." This statement confused me
> because you seem to be implying it works when it's in Session which
> doesn't make sense since even with a Session scoped form you still need
> to some initial population somewhere.
> 
> Typically I feel you should always go to some sort of "setUp" action or
> dispatch method BEFORE you ever forward to a form. Initially you can
> often skip this step but later on there will be something you want to
> 'do' before you get to the form anyway so I find it good practice to go
> to a 'set up' first.
> 
> For the two problems listed above the link Naill posted is good
> http://wiki.apache.org/struts/StrutsCatalogLazyList (and I just recently
> added to that link the way I like to do it).
> 
> Let us know if you can't get it to work. I have to use Nested stuff all
> the time, so I'll be able to help.
> 
> --
> Rick
> 
> -
> 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 over list in in list in form bean.

2005-07-18 Thread Mike Elliott
On 7/18/05, Rick Reumann <[EMAIL PROTECTED]> wrote:

> I'm still not totally clear where the problem is, since I'm not sure
> what Session has to do with the initial setup of the form.

The difference is unobvious, I admit, but this is what I was thinking
of:  If I use a session bean, I can do some sort of setup (from an
Action) on its initial creation, including creating the list of
contained objects.  That can't happen if it's in request scope because
there is no chance to invoke the setup before the bean is populated
from the request.

> 1) A problem when you submit the form and getting 'index' problems
> showing up in the logs?

More than showing up, the submit was trying to populate the bean with
indexed properties but the list containing the indexed properties was
of size zero.  The
answer to the problem was given by the previous posters.  Thanks guys.  

What made the difference was the Wiki page section (BeanUtils Indexed
Properties Issue) pointing out that there is a bug in JDK 1.4 which
prevents the solution of writing your own getXXX( int ndx ) property. 
I had done that (in desperation) and when that didn't work either, I
threw up my hands and wrote the list.  I felt that it _should_ have
worked and when it didn't I just assumed my understanding of the
situation was inadequate and gave up.  I'm delighted to find out that
the problem is in the implementation and not in my mental picture of
how this whole thing works.
 
> I'm confused because you mention "But, of course, a newly created form
> won't know how many elements are in the form so it can't pre-populate
> the collection with beans to be filled in." This statement confused me
> because you seem to be implying it works when it's in Session which
> doesn't make sense since even with a Session scoped form you still need
> to some initial population somewhere.

But you can do that once, before all this other stuff takes place.  I
realize that wasn't an obvious inference but that's what I meant.

> Typically I feel you should always go to some sort of "setUp" action or
> dispatch method BEFORE you ever forward to a form.

But doesn't that go away in request scope when the form is submitted
back to the Action?  Doesn't a new form get created and populated from
the HTML?  It sure looks like that's what's happening to me.

> For the two problems listed above the link Naill posted is good
> http://wiki.apache.org/struts/StrutsCatalogLazyList (and I just recently
> added to that link the way I like to do it).

I came up with another solution which might be worthy of
consideration.  Instead of using arrays, extend a list with the
desired get( int ) method and use that list instead:

 public class SkillActionForm extends ActionForm {

  protected List skills = new LazyArrayList();

  public class LazyArrayList extends ArrayList {
 public Object get( int index ) {
while (size() <= index) add( new SkillBean()  );
return super.get( index );
 }
  }
  }

This is the solution I eventually adopted (successfully) but I have a
fondness for nested classes which others may not share.

Anyway, thanks to all, I've gotten past the problem with an increased
understanding of the intricacies of this here Struts stuff.

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Rick Reumann

Andrew Tomaka wrote the following on 7/18/2005 2:13 PM:


I have a form which allows users to add a dynamic amount of rows (via
a button that says "Add Row") and then submit the form with as little
or many rows as they wish.  Can a form bean be setup using collections
instead of other object types?  What is the proper way to handle a
dynamic amount of the same data coming in to a Action?


I think to set this up where the user can add as many as they wish 
you'll have to do some DHTML stuff where you will be writing out the new 
elements using javascript. You'll probably have to keep track of what's 
in the currentDiv and append to it when they click "add new"


You'll need a counter of the 'currentIndex' and you'll end up writing 
javascript to write to a div that will make the elements like...


write( currentDivContents + "propety='yourList["+curIndex+"].firstName'/>");


Of course make sure for your "yourList" that you use an approach like

http://wiki.apache.org/struts/StrutsCatalogLazyList

An easier approach might be to only allow them to enter a fixed amount 
at a time, say five or so. After they submit they could enter more. This 
would cut down on the amount of javascript.


And yes in either scenario you set up your ActionForm to use a property 
of type List that would hold your Collection of beans.


--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Rick Reumann

Michael Jouravlev wrote the following on 7/18/2005 3:59 PM:


ActionForm.reset() for session-scoped forms, ActionForm.ActionForm()
for request-scoped forms. I do not remeber, if reset() is called for
request-scoped forms.


Yes, reset is always called when the form submits. I know I mentioned in 
this in another post but I would disagree with repopulating your beans 
in the reset() UNLESS... you did adopt the whole ball of wax the way you 
have designed your stuff Michael. In other words if you go with your 
approach of the form beans doing other stuff than holding user input, 
than you can go ahead and mess with the reset doing that kind of stuff, 
but if Mike is sticking to 'typical' Struts than I wouldn't recommend 
repopulating in the reset.



Why would you want to use request scope anyway? I use session scope
and I am pretty happy.


Well I could see for large forms with nested data it might not be a 
great idea to keep these around in the Session. I 'try' to stick to 
using the Request when I can but I don't bend over backwards like 
some do on this list to avoid the Session.. I'm in "The Session is  your 
friend" camp:). Request will work fine however for Mike's situation. He 
just needs to wrap his collection in his ActionForm around a LazyList 
(or he can use a regular list and do the handcranking approach of 
incrementing the size when needed in the getList property in his form. 
LazyList is cleaner, though).



--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Michael Jouravlev
On 7/18/05, Mike Elliott <[EMAIL PROTECTED]> wrote:
> If I use a session bean, I can do some sort of setup (from an
> Action) on its initial creation, including creating the list of
> contained objects.  That can't happen if it's in request scope because
> there is no chance to invoke the setup before the bean is populated
> from the request.

ActionForm.reset() for session-scoped forms, ActionForm.ActionForm()
for request-scoped forms. I do not remeber, if reset() is called for
request-scoped forms.

Why would you want to use request scope anyway? I use session scope
and I am pretty happy.

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Rick Reumann

Mike Elliott wrote the following on 7/18/2005 10:55 AM:


I've been beating my head against this all weekend to no avail.  I
understand how to do this in session scope, but don't know if it's
even possible in request scope.

As I understand things (which may be wrong), when the form is
submitted (in request scope) a new form bean is created and populated
with the values in the collection from the HTML form.  But, of course,
a newly created form won't know how many elements are in the form so
it can't pre-populate the collection with beans to be filled in. 
Right?


I'm still not totally clear where the problem is, since I'm not sure 
what Session has to do with the initial setup of the form. It might help 
if you let us know what the exact problem is when using request scope...


1) A problem when you submit the form and getting 'index' problems 
showing up in the logs?


2) Is it making sure the nested structure is still there when validation 
fails?


I'm confused because you mention "But, of course, a newly created form 
won't know how many elements are in the form so it can't pre-populate 
the collection with beans to be filled in." This statement confused me 
because you seem to be implying it works when it's in Session which 
doesn't make sense since even with a Session scoped form you still need 
to some initial population somewhere.


Typically I feel you should always go to some sort of "setUp" action or 
dispatch method BEFORE you ever forward to a form. Initially you can 
often skip this step but later on there will be something you want to 
'do' before you get to the form anyway so I find it good practice to go 
to a 'set up' first.


For the two problems listed above the link Naill posted is good 
http://wiki.apache.org/struts/StrutsCatalogLazyList (and I just recently 
added to that link the way I like to do it).


Let us know if you can't get it to work. I have to use Nested stuff all 
the time, so I'll be able to help.


--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Michael Jouravlev
On 7/18/05, Mike Elliott <[EMAIL PROTECTED]> wrote:
> > Well I could see for large forms with nested data it might not be a
> > great idea to keep these around in the Session. I 'try' to stick to
> > using the Request when I can but I don't bend over backwards like
> > some do on this list to avoid the Session.. I'm in "The Session is  your
> > friend" camp:). Request will work fine however for Mike's situation. He
> > just needs to wrap his collection in his ActionForm around a LazyList
> > (or he can use a regular list and do the handcranking approach of
> > incrementing the size when needed in the getList property in his form.
> > LazyList is cleaner, though).
> 
> Request is required for my situation -- the user can have multiple
> versions of the same page active in the same session.  That's what
> drove me away from the 'working' session scope bean -- I had users who
> were messing up the session scoped bean by opening the same page
> multiple times and making modifications.

Wicket has versioning for situations like this. I am thinking, does it
make sense to create versioned action forms for Struts?

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Mike Elliott
> Well I could see for large forms with nested data it might not be a
> great idea to keep these around in the Session. I 'try' to stick to
> using the Request when I can but I don't bend over backwards like
> some do on this list to avoid the Session.. I'm in "The Session is  your
> friend" camp:). Request will work fine however for Mike's situation. He
> just needs to wrap his collection in his ActionForm around a LazyList
> (or he can use a regular list and do the handcranking approach of
> incrementing the size when needed in the getList property in his form.
> LazyList is cleaner, though).

Request is required for my situation -- the user can have multiple
versions of the same page active in the same session.  That's what
drove me away from the 'working' session scope bean -- I had users who
were messing up the session scoped bean by opening the same page
multiple times and making modifications.

I don't see LazyList as any cleaner.  You have to add one method in
either case.  With LazyList you have to implement Factory then add the
create() method.  Extending ArrayList you have to implement a new
get().  I'll stick with the latter.

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Michael Jouravlev
On 7/18/05, Rick Reumann <[EMAIL PROTECTED]> wrote:
> Michael Jouravlev wrote the following on 7/18/2005 3:59 PM:
> 
> > ActionForm.reset() for session-scoped forms, ActionForm.ActionForm()
> > for request-scoped forms. I do not remeber, if reset() is called for
> > request-scoped forms.
> 
> Yes, reset is always called when the form submits. I know I mentioned in
> this in another post but I would disagree with repopulating your beans
> in the reset() UNLESS... you did adopt the whole ball of wax the way you
> have designed your stuff Michael. In other words if you go with your
> approach of the form beans doing other stuff than holding user input,
> than you can go ahead and mess with the reset doing that kind of stuff,
> but if Mike is sticking to 'typical' Struts than I wouldn't recommend
> repopulating in the reset.

'Typical' is not always better. I am finishing rewriting Mail Reader
using my approach, and it looks much cleaner, at least to me ;) and is
more robust. I understand that having session objects opens a whole
can of worms related to garbage-collecting of abandoned objects, and
Struts does not have this facility. I saw a project which does just
that, but cannot find it now ;(

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Martin Gainty

Good Morning Mike
There are a Number of options for implementing with request scope and manual 
validation explained by Rick Reumann

http://www.reumann.net/struts/articles/request_lists.jsp

I think its worth noting what Thomas Edison said of  weekend warriors
"I have not failed. I've just found 10,000 ways that won't work."-- Thomas 
Edison


- Original Message - 
From: "Mike Elliott" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Monday, July 18, 2005 10:55 AM
Subject: Re: Iterate over list in in list in form bean.


On 7/13/05, Jörg Eichhorn <[EMAIL PROTECTED]> wrote:


thanks for the hint and example. I've choosen the nested way to do this,
because i
think this makes the jsp code more readable.

I there a way to do the same using request scope?
When i do this i get an exception because the collection is not re-filled
anymore.


This is the same question I have, but of course I'm a week late in
asking it.  However, I noticed that no one answered  Jörg's version so
I'll ask it again:

 Is there a way to do the same using request scope?

I've been beating my head against this all weekend to no avail.  I
understand how to do this in session scope, but don't know if it's
even possible in request scope.

As I understand things (which may be wrong), when the form is
submitted (in request scope) a new form bean is created and populated
with the values in the collection from the HTML form.  But, of course,
a newly created form won't know how many elements are in the form so
it can't pre-populate the collection with beans to be filled in.
Right?  So following this path leads to wailing, lamentation, gnashing
of teeth, rending of clothes and utter frustration.  Right?

If there is simply no way to do this, I'd really appreciate someone
letting me know so that I'm put out of my misery.  And, if someone
could suggest a workaround, I'd be most welcome.

-
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 over list in in list in form bean.

2005-07-18 Thread Niall Pemberton
There are ways to resolve this, see this page on the wiki

http://wiki.apache.org/struts/StrutsCatalogLazyList

Niall

- Original Message - 
From: "Mike Elliott" <[EMAIL PROTECTED]>
Sent: Monday, July 18, 2005 3:55 PM


On 7/13/05, Jörg Eichhorn <[EMAIL PROTECTED]> wrote:

> thanks for the hint and example. I've choosen the nested way to do this,
> because i
> think this makes the jsp code more readable.
>
> I there a way to do the same using request scope?
> When i do this i get an exception because the collection is not re-filled
> anymore.

This is the same question I have, but of course I'm a week late in
asking it.  However, I noticed that no one answered  Jörg's version so
I'll ask it again:

  Is there a way to do the same using request scope?

I've been beating my head against this all weekend to no avail.  I
understand how to do this in session scope, but don't know if it's
even possible in request scope.

As I understand things (which may be wrong), when the form is
submitted (in request scope) a new form bean is created and populated
with the values in the collection from the HTML form.  But, of course,
a newly created form won't know how many elements are in the form so
it can't pre-populate the collection with beans to be filled in.
Right?  So following this path leads to wailing, lamentation, gnashing
of teeth, rending of clothes and utter frustration.  Right?

If there is simply no way to do this, I'd really appreciate someone
letting me know so that I'm put out of my misery.  And, if someone
could suggest a workaround, I'd be most welcome.



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



Re: Iterate over list in in list in form bean.

2005-07-18 Thread Mike Elliott
On 7/13/05, Jörg Eichhorn <[EMAIL PROTECTED]> wrote:

> thanks for the hint and example. I've choosen the nested way to do this,
> because i
> think this makes the jsp code more readable.
> 
> I there a way to do the same using request scope?
> When i do this i get an exception because the collection is not re-filled
> anymore.

This is the same question I have, but of course I'm a week late in
asking it.  However, I noticed that no one answered  Jörg's version so
I'll ask it again:

  Is there a way to do the same using request scope?

I've been beating my head against this all weekend to no avail.  I
understand how to do this in session scope, but don't know if it's
even possible in request scope.

As I understand things (which may be wrong), when the form is
submitted (in request scope) a new form bean is created and populated
with the values in the collection from the HTML form.  But, of course,
a newly created form won't know how many elements are in the form so
it can't pre-populate the collection with beans to be filled in. 
Right?  So following this path leads to wailing, lamentation, gnashing
of teeth, rending of clothes and utter frustration.  Right?

If there is simply no way to do this, I'd really appreciate someone
letting me know so that I'm put out of my misery.  And, if someone
could suggest a workaround, I'd be most welcome.

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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Michael Jouravlev
On 7/13/05, Leon Rosenberg <[EMAIL PROTECTED]> wrote:
> It's not Friday, but I'd like to now what you need the JSTL tags for? What
> is it, what you can't do with standart (struts without EL) tags? What do you
> need EL for?
> 
> Regards
>  Leon :-)

How about "I want to fork Struts into StrutsWorks, and I want to take
only the most essential part of it, so no one would accuse me in
stealing and putting my name on other's stuff"?

:-)

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



AW: Iterate over list in in list in form bean.

2005-07-13 Thread Leon Rosenberg
 

> -Ursprüngliche Nachricht-
> Von: Rick Reumann [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 14. Juli 2005 00:25
> An: Struts Users Mailing List
> Betreff: Re: Iterate over list in in list in form bean.
> 
> Wendy Smoak wrote the following on 7/13/2005 6:14 PM:
> 
> > Struts-EL gives you the ability to use expressions in the 
> Struts tags.  
> > I think it's more than a convenience... for example, how would you 
> > rewrite the code above if you could not use an expression 
> in the 'value' attribute?
> 
> Struts-EL tags are a must if you aren't on JSP 2.0. No 
> debating this - Discussion over:)
> 
> --
> Rick

It's not Friday, but I'd like to now what you need the JSTL tags for? What
is it, what you can't do with standart (struts without EL) tags? What do you
need EL for? 

Regards
 Leon :-)



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



AW: Iterate over list in in list in form bean.

2005-07-13 Thread Leon Rosenberg
 

> -Ursprüngliche Nachricht-
> Von: Rick Reumann [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 14. Juli 2005 00:25
> An: Struts Users Mailing List
> Betreff: Re: Iterate over list in in list in form bean.
> 
> Wendy Smoak wrote the following on 7/13/2005 6:14 PM:
> 
> > Struts-EL gives you the ability to use expressions in the 
> Struts tags.  
> > I think it's more than a convenience... for example, how would you 
> > rewrite the code above if you could not use an expression 
> in the 'value' attribute?
> 
> Struts-EL tags are a must if you aren't on JSP 2.0. No 
> debating this - Discussion over:)
> 
> --
> Rick

It's not Friday, but I'd like to now what you need the JSTL tags for? What
is it, what you can't do with standart (struts without EL) tags? What do you
need EL for? 

Regards
 Leon :-)



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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Michael Jouravlev
On 7/13/05, Rick Reumann <[EMAIL PROTECTED]> wrote:
> Wendy Smoak wrote the following on 7/13/2005 6:14 PM:
> 
> > Struts-EL gives you the ability to use expressions in the Struts tags.  I
> > think it's more than a convenience... for example, how would you rewrite the
> > code above if you could not use an expression in the 'value' attribute?
> 
> Struts-EL tags are a must if you aren't on JSP 2.0. No debating this -
> Discussion over:)

Would you care to point to explanation? ;) I want to abandon struts
tags completely, so I am really interested.

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Rick Reumann

Wendy Smoak wrote the following on 7/13/2005 6:14 PM:


Struts-EL gives you the ability to use expressions in the Struts tags.  I
think it's more than a convenience... for example, how would you rewrite the
code above if you could not use an expression in the 'value' attribute?


Struts-EL tags are a must if you aren't on JSP 2.0. No debating this - 
Discussion over:)


--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Wendy Smoak
From: "Michael Jouravlev" <[EMAIL PROTECTED]>

> >
> >   
> >

>  is Struts-EL tag, is not it?  I would prefer to use JSTL
> only. I think I can do that. But it this case, what Struts-EL is for?
> For convenience only?

Struts-EL gives you the ability to use expressions in the Struts tags.  I
think it's more than a convenience... for example, how would you rewrite the
code above if you could not use an expression in the 'value' attribute?

I'm as resistant as anyone to adding Yet Another Taglib to a project, but
this one is just a subset of the original Struts tags, modified to accept
expressions.

-- 
Wendy Smoak


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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Michael Jouravlev
On 7/13/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> From: "Michael Jouravlev" <[EMAIL PROTECTED]>
> 
> >> Showing side by side examples from
> >>Struts "classic",
> >>Struts-EL + JSTL 1.0, and
> >>Struts + JSP 2.0 + JSTL 1.1
> >> is on my TODO list
> 
> > Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
> > is not possible?
> 
> (Is this a trick question?) 

No, it is not a trick question. I just started with JSTL. I used only
Struts tags before.

> Sure, it's possible.  It's going to make some
> things harder than they need to be, such as...
> 
>
>   
>
> 
> And using Struts-EL will force you into the recommended practice of using
> the JSTL tags whenever possible, because the Struts tags with JSTL
> equivalents were intentionally left out.

 is Struts-EL tag, is not it? I would prefer to use JSTL
only. I think I can do that. But it this case, what Struts-EL is for?
For convenience only?

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Laurie Harper

Michael Jouravlev wrote:


On 7/12/05, Laurie Harper <[EMAIL PROTECTED]> wrote:


Michael Jouravlev wrote:


Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
is not possible?


I don't know about 'possible' but JSP 1.2 includes JSTL 1.1, so why would
you want to?



http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html

"Standard-1.1 (JSTL 1.1) requires a JSP container that supports the
Java Servlet 2.4 and JavaServer Pages 2.0 specifications.

Standard-1.0 (implementation of the JSTL 1.0 specification) requires a
JSP container that supports the Java Servlet 2.3 and JavaServer Pages
1.2 specifications."

Michael.


Oops, I mis-read 1.2 as 2.0! Doh...

--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Wendy Smoak
From: "Michael Jouravlev" <[EMAIL PROTECTED]>

>> Showing side by side examples from
>>Struts "classic",
>>Struts-EL + JSTL 1.0, and
>>Struts + JSP 2.0 + JSTL 1.1
>> is on my TODO list

> Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
> is not possible?

(Is this a trick question?)  Sure, it's possible.  It's going to make some
things harder than they need to be, such as...

   
  
   

And using Struts-EL will force you into the recommended practice of using
the JSTL tags whenever possible, because the Struts tags with JSTL
equivalents were intentionally left out.

-- 
Wendy Smoak


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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Jörg Eichhorn

Hi  Martin,

i didn't think of the users who deleted previous posts.
Here you can find it: 
http://www.mail-archive.com/user%40struts.apache.org/msg30141.html


--On Mittwoch, 13. Juli 2005 09:59 -0400 Martin Gainty 
<[EMAIL PROTECTED]> wrote:



Jörg
Hard to answer a reference to a previous posting when the previous
posting was erased
It would help if you would include previous posts from thread when
replying .
More specifically if there is information from a previous post which you
are referencing it is best practice to include in the referenced info..
Vielen Danke,
Martin



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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Michael Jouravlev
On 7/12/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
> Michael Jouravlev wrote:
> > Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
> > is not possible?
> 
> I don't know about 'possible' but JSP 1.2 includes JSTL 1.1, so why would
> you want to?

http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html

"Standard-1.1 (JSTL 1.1) requires a JSP container that supports the
Java Servlet 2.4 and JavaServer Pages 2.0 specifications.

Standard-1.0 (implementation of the JSTL 1.0 specification) requires a
JSP container that supports the Java Servlet 2.3 and JavaServer Pages
1.2 specifications."

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-13 Thread Martin Gainty

Jörg
Hard to answer a reference to a previous posting when the previous posting 
was erased
It would help if you would include previous posts from thread when replying 
.
More specifically if there is information from a previous post which you are 
referencing it is best practice to include in the referenced info..

Vielen Danke,
Martin
- Original Message - 
From: "Jörg Eichhorn" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Wednesday, July 13, 2005 4:47 AM
Subject: Re: Iterate over list in in list in form bean.


Hello,

thanks for the hint and example. I've choosen the nested way to do this,
because i
think this makes the jsp code more readable.

I there a way to do the same using request scope?
When i do this i get an exception because the collection is not re-filled
anymore.
In my previous example the first collection was recreated via the
getCollection(int index) method.

Thanks again.

Jörg Eichhorn

-
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 over list in in list in form bean.

2005-07-13 Thread Jörg Eichhorn

Hello,

thanks for the hint and example. I've choosen the nested way to do this, 
because i

think this makes the jsp code more readable.

I there a way to do the same using request scope?
When i do this i get an exception because the collection is not re-filled 
anymore.
In my previous example the first collection was recreated via the 
getCollection(int index) method.


Thanks again.

Jörg Eichhorn

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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Laurie Harper

Michael Jouravlev wrote:

Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
is not possible?


I don't know about 'possible' but JSP 1.2 includes JSTL 1.1, so why would 
you want to?


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Rick Reumann

Wendy Smoak wrote the following on 7/12/2005 7:48 PM:

From: "Rick Reumann" <[EMAIL PROTECTED]>


Here's an example from a demo app that I keep meaning
to post to show how it can be done using either the nested or regular
JSTL tags...



Please do!  Showing side by side examples from
   Struts "classic",
   Struts-EL + JSTL 1.0, and
   Struts + JSP 2.0 + JSTL 1.1


Well I sort of did most the part that you'd be concerned with:) The rest 
of the demo deals with dealing with the Lists to not get 
indexOutOfBounds etc... problem is so many different ways to deal with it.


<%-- JSTL way --%>

varStatus="divstatus">
Division: value="${division.name}" />
varStatus="depstatus">
--- Department: property="divisions[${divstatus.index}].departments[${depstatus.index}].name" 
value="${department.name}" />





<%-- Nested tag way --%>


  
Division: 

--- Department: 

  



--
Rick

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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Michael Jouravlev
On 7/12/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> From: "Rick Reumann" <[EMAIL PROTECTED]>
> 
> >  Here's an example from a demo app that I keep meaning
> > to post to show how it can be done using either the nested or regular
> > JSTL tags...
> 
> Please do!  Showing side by side examples from
>Struts "classic",
>Struts-EL + JSTL 1.0, and
>Struts + JSP 2.0 + JSTL 1.1
> is on my TODO list, and I'm sure you've done a much better job of it than I
> could.

Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL)
is not possible?

Michael.

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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Wendy Smoak
From: "Rick Reumann" <[EMAIL PROTECTED]>

>  Here's an example from a demo app that I keep meaning
> to post to show how it can be done using either the nested or regular
> JSTL tags...

Please do!  Showing side by side examples from
   Struts "classic",
   Struts-EL + JSTL 1.0, and
   Struts + JSP 2.0 + JSTL 1.1
is on my TODO list, and I'm sure you've done a much better job of it than I
could.

-- 
Wendy Smoak


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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Rick Reumann

Wendy Smoak wrote the following on 7/12/2005 7:12 PM:

From: "Jörg Eichhorn" <[EMAIL PROTECTED]>


i have a form bean with a list property of complex object which also
contains a list of objects. When iterating over the first list and using
indexed elements, then values of the first list are transferred back when
submitting the form. The values of the inner list is displayed correctly
but is not transmitted back on submit.



I think you need to use the nested taglib for this:
   http://struts.apache.org/userGuide/dev_nested.html



You can do this without using the nested tags, but the nested tags make 
it much cleaner. Here's an example from a demo app that I keep meaning 
to post to show how it can be done using either the nested or regular 
JSTL tags...


Company has divisions and in each division there is a list of 
departments with names.


<%-- JSTL way --%>

varStatus="divstatus">
Division: value="${division.name}" />
varStatus="depstatus">
--- Department: property="divisions[${divstatus.index}].departments[${depstatus.index}].name" 
value="${department.name}" />





<%-- Nested tag way --%>


  
Division: 

--- Department: 

  




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



Re: Iterate over list in in list in form bean.

2005-07-12 Thread Wendy Smoak
From: "Jörg Eichhorn" <[EMAIL PROTECTED]>
> i have a form bean with a list property of complex object which also
> contains a list of objects. When iterating over the first list and using
> indexed elements, then values of the first list are transferred back when
> submitting the form. The values of the inner list is displayed correctly
> but is not transmitted back on submit.

I think you need to use the nested taglib for this:
   http://struts.apache.org/userGuide/dev_nested.html

-- 
Wendy Smoak



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



Iterate over list in in list in form bean.

2005-07-12 Thread Jörg Eichhorn

Hi all,

i have a form bean with a list property of complex object which also 
contains a list of objects. When iterating over the first list and using 
indexed elements, then values of the first list are transferred back when 
submitting the form. The values of the inner list is displayed correctly 
but is not transmitted back on submit.


Form Bean:
- some String properties
- a List property of Data1 objects


Data1 Object:
- some String properties
- a List property of Data2 object


Data2 Object:
- some String properties



JSP looks somehow like the following:

---snip

 
 
 

 type="test.Data1">

   
   

   type="test.Data2">

 
 
   



---snip


I've implemented the method getD1(int index) (+ normal getter/setter) in 
the form bean and also corresponing methods in the Data1 class.


The List of Data2 object is null when the form is submitted.


Thanks for help.

Jörg Eichhorn


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