Re: Nested Tags question

2002-06-14 Thread Jeff_Mychasiw



Looking forward to that tutorial

BTW A comment on your tutorial work:
IMHO, you have raised the standards regarding Struts tutorials.
 After completing these on your site, you were able to convince me why I wanted
to use nested tags
as well how to use them.

Keep up the good work.





Arron Bates <[EMAIL PROTECTED]> on 06/14/2002 12:14:56 AM

Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>

To:   Struts Users Mailing List <[EMAIL PROTECTED]>
cc:

Subject:  Re: Nested Tags question


Adam,

Back to the old "want lists, but no session objects" issue. It's a
common problem these days. It's hard to get the list model working
nicely without "knowing" how big the list is going to be so that objects
can be set against valid indexes.

The post you speek of in the archives is that I've made a collections
wrapps in the commons project which will wrap collections so that they
can expand by definition when the request comes in with indexed or
mapped properties.

I'm cutting a short tutorial on it ("how to make funky complex form
models leaving the session object in the closet"), should be finished in
the next few days. It should help a lot of people. Most people end up
with indexed lists, but it's hard to get them working properly on the
back end. It's not just a nested tags thing.

If you don't mind wading through code and having a go at the collections
wrapper with nothing but javadoc (good javadoc though :)...

http://cvs.apache.org/viewcvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LazyCollections.java



Arron.


Adam Hardy wrote:

> Hi Down Under,
>
> thanks for the reply. I figured that the form properties setting thing
> must be struts, after checking out the JSP spec. JSP does do a certain
> amount of it though, since you can specify a tag in your jsp and say
> parameters="*" - and JSP will match any parameters in the request to
> methods on the tag's bean.
>
> Anyway sorry for sounding like such a dumbass but I've been through
> your tutorials. For the display, I've got the nested tags sussed -
> it's for the save on submit that I'm having problems. It's one of
> those aggravating problems that I can't pin down so it's difficult to
> ask the right questions.
>
> I've actually hacked out some code to stuff the request parameters
> into the bean structure by hand in the form's validate method.
> Obviously I'd like to do it automatically but I had to get the app
> working. To try to sort out what I've done wrong, I'll strip it back
> to the simplest bare bones and take it from there.
>
> What I can't work out from playing with your SavingMonkey demo is how
> struts gets the request parameters into beans inside each other inside
> the formbean. Is it necessary to instantiate the right amount of empty
> beans first? I see SavingMonkey instantiates everything on construction.
>
> When saving request parameters to the beans in the formbean, does
> struts call the beans' getter methods to get the ArrayLists and beans?
> I can't see how else it would get access the setter methods on the
> deeper nested beans.
>
> Thanks for your help. I did see a message in the archives here but I
> can't find it again, where you were talking about changes awaiting
> acceptance in CVS - is that just stuff that is now incorporated into
> struts 1.1? I'm using 1.0.2
>
> All the best,
> Adam




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








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




Re: Nested Tags question

2002-06-14 Thread Arron Bates

> As far as the problem goes concerning setting against valid indices, 
> my code does that simply enough using a check against ArrayList.size() 
> and the index from the request parameter - if the size is too small, I 
> just add new objects - 3 lines of code. This is all in a for loop, 
> which could recurse - presumably what your commons wrapper does. Guess 
> I'll find out. 



That's pretty much what it does.
Only thing is it's tackled at the collection level so that you only need 
to use the properties which return and set the collection itself. You 
have to provide one of these to the iterate tags anyways. Means you 
don't have to manage the collections yourself.

It's all of a muchness, so I'll just say it's less to be concerned with 
on a regular basis as a wrapper  :)


Arron.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested Tags question

2002-06-13 Thread Adam Hardy

Hi there,
I'll take a look at it this weekend. I don't get your reference to no 
session objects.

As far as the problem goes concerning setting against valid indices, my 
code does that simply enough using a check against ArrayList.size() and 
the index from the request parameter - if the size is too small, I just 
add new objects - 3 lines of code. This is all in a for loop, which 
could recurse - presumably what your commons wrapper does. Guess I'll 
find out.

All the best
Adam

Arron Bates wrote:

> Adam,
>
> Back to the old "want lists, but no session objects" issue. It's a 
> common problem these days. It's hard to get the list model working 
> nicely without "knowing" how big the list is going to be so that 
> objects can be set against valid indexes.
>
> The post you speek of in the archives is that I've made a collections 
> wrapps in the commons project which will wrap collections so that they 
> can expand by definition when the request comes in with indexed or 
> mapped properties.
>
> I'm cutting a short tutorial on it ("how to make funky complex form 
> models leaving the session object in the closet"), should be finished 
> in the next few days. It should help a lot of people. Most people end 
> up with indexed lists, but it's hard to get them working properly on 
> the back end. It's not just a nested tags thing.
>
> If you don't mind wading through code and having a go at the 
> collections wrapper with nothing but javadoc (good javadoc though :)...
>
> 
>http://cvs.apache.org/viewcvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LazyCollections.java
> 
>
>
>
> Arron.
>
>
> Adam Hardy wrote:
>
>> Hi Down Under,
>>
>> thanks for the reply. I figured that the form properties setting 
>> thing must be struts, after checking out the JSP spec. JSP does do a 
>> certain amount of it though, since you can specify a tag in your jsp 
>> and say parameters="*" - and JSP will match any parameters in the 
>> request to methods on the tag's bean.
>>
>> Anyway sorry for sounding like such a dumbass but I've been through 
>> your tutorials. For the display, I've got the nested tags sussed - 
>> it's for the save on submit that I'm having problems. It's one of 
>> those aggravating problems that I can't pin down so it's difficult to 
>> ask the right questions.
>>
>> I've actually hacked out some code to stuff the request parameters 
>> into the bean structure by hand in the form's validate method. 
>> Obviously I'd like to do it automatically but I had to get the app 
>> working. To try to sort out what I've done wrong, I'll strip it back 
>> to the simplest bare bones and take it from there.
>>
>> What I can't work out from playing with your SavingMonkey demo is how 
>> struts gets the request parameters into beans inside each other 
>> inside the formbean. Is it necessary to instantiate the right amount 
>> of empty beans first? I see SavingMonkey instantiates everything on 
>> construction.
>>
>> When saving request parameters to the beans in the formbean, does 
>> struts call the beans' getter methods to get the ArrayLists and 
>> beans? I can't see how else it would get access the setter methods on 
>> the deeper nested beans.
>>
>> Thanks for your help. I did see a message in the archives here but I 
>> can't find it again, where you were talking about changes awaiting 
>> acceptance in CVS - is that just stuff that is now incorporated into 
>> struts 1.1? I'm using 1.0.2
>>
>> All the best,
>> Adam
>
>
>
>
>
> -- 
> To unsubscribe, e-mail:   
> 
> For additional commands, e-mail: 
> 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested Tags question

2002-06-13 Thread Arron Bates

try...

document.forms[0]["mailingAddress.city"]

...works a treat.


Arron.

Jayaraman Dorai wrote:

>When I use nested tags, I am not able to access it through java scripts since the 
>name is "mailingAddress.city". Does anyone have a work around or am I missing 
>something?
>
>Jayaraman
>
>-Original Message-
>From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, June 13, 2002 12:23 PM
>To: Struts Users Mailing List
>Subject: Re: Re: Nested Tags question
>
>
>
>
>On Thu, 13 Jun 2002 [EMAIL PROTECTED] wrote:
>
>>Date: Thu, 13 Jun 2002 11:43:59 +0200
>>From: [EMAIL PROTECTED]
>>Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>Subject: Re: Re: Nested Tags question
>>
>>So Craig,
>>does the process work at submit time (when the request parameters are
>>being put into the nested beans) via calls to the getter methods to get
>>the beans on which the parameters have to be set?
>>
>>I can't see how else it would work.
>>
>
>It depends on what context you are using the expressions in.  For example:
>
>  
>  
>...
>
>...
>  
>
>will, in effect, do a call to:
>
>  customerForm.getMailingAddress().getCity()
>
>when the page is displayed, and a call to:
>
>  customerForm.getMailingAddress().setCity()
>
>when the request parameters are being copied in to the form bean.
>
>>Adam
>>
>
>Craig
>
>
>>
>>"Craig R. McClanahan" <[EMAIL PROTECTED]> schrieb am 13.06.2002,
>>08:22:43:
>>
>>>
>>>On Thu, 13 Jun 2002, Arron Bates wrote:
>>>
>>>>Date: Thu, 13 Jun 2002 14:14:13 +1000
>>>>From: Arron Bates
>>>>Reply-To: Struts Users Mailing List
>>>>To: Struts Users Mailing List
>>>>Subject: Re: Nested Tags question
>>>>
>>>>>
>>>>>I know JSP will automatically save parameters to a javabean with the
>>>>>correctly named getters and setters, but there's obviously a gap in my
>>>>>knowledge because all my attempts to recreate the situation above have
>>>>>failed.
>>>>>
>>>>Setting form properties against beans is a Struts thing, not a JSP
>>>>thing. The property thing is a Bean thin and can be looked up in the
>>>>JavaBean spec.
>>>>
>>>>The example you quote...
>>>>
>>>>"monkeyTeamAlpha.monkeyWorkers[0].salary"
>>>>
>>>>...is a nested property. An invention implemented within Struts
>>>>(Craig?).
>>>>
>>>Yep, although in Struts 1.1 it is really a "commons-beanutils" thing
>>>because we abstracted out this generally useful code into a separate
>>>package.
>>>
>>>>What it basically is, is a string of calls rather than the
>>>>single property method. Here, it will get a hold of the form bean, get a
>>>>hold of the bean returned from the "monkeyTeamAlpha"property. On this
>>>>bean, it will invoke the indexed property "monkeyWorkers[0]" which will
>>>>pluck a bean from a collection or index provided, from this last bean it
>>>>will will get a hold of its "salary" property, and set the value.
>>>>
>>>At each stage, you also get the benefit of some intelligence that is built
>>>in to the underlying PropertyUtils class.  For example, the JavaBeans spec
>>>defines two ways to define an indexed property -- you can use getter and
>>>setter methods that take a value and a subscript, or you can use getter
>>>and setter methods that return the entire array.  PropertyUtils makes the
>>>expression listed above work for either (or even for a property whose
>>>value is a java.util.List, which is an extension to the JavaBeans spec).
>>>
>>>>All this boils down to, is that you can compose objects a little
>>>>cleaner, rather than have truly enormous beans for everything. Having
>>>>the indexed properties allows for lists and whatever else.
>>>>
>>>>The ability for nesting beans has been in Struts for a long time. The
>>>>nested tags just make it much easier.
>>>>
>>>>There's a primer and tutorial for nested beans here...
>>>>
>>>>http://www.keyboardmonkey.com/next
>>>>
>>>>...it should take you over creating and using such a construct.
>

Re: Nested Tags question

2002-06-13 Thread Arron Bates

Adam,

Back to the old "want lists, but no session objects" issue. It's a 
common problem these days. It's hard to get the list model working 
nicely without "knowing" how big the list is going to be so that objects 
can be set against valid indexes.

The post you speek of in the archives is that I've made a collections 
wrapps in the commons project which will wrap collections so that they 
can expand by definition when the request comes in with indexed or 
mapped properties.

I'm cutting a short tutorial on it ("how to make funky complex form 
models leaving the session object in the closet"), should be finished in 
the next few days. It should help a lot of people. Most people end up 
with indexed lists, but it's hard to get them working properly on the 
back end. It's not just a nested tags thing.

If you don't mind wading through code and having a go at the collections 
wrapper with nothing but javadoc (good javadoc though :)...

http://cvs.apache.org/viewcvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LazyCollections.java


Arron.


Adam Hardy wrote:

> Hi Down Under,
>
> thanks for the reply. I figured that the form properties setting thing 
> must be struts, after checking out the JSP spec. JSP does do a certain 
> amount of it though, since you can specify a tag in your jsp and say 
> parameters="*" - and JSP will match any parameters in the request to 
> methods on the tag's bean.
>
> Anyway sorry for sounding like such a dumbass but I've been through 
> your tutorials. For the display, I've got the nested tags sussed - 
> it's for the save on submit that I'm having problems. It's one of 
> those aggravating problems that I can't pin down so it's difficult to 
> ask the right questions.
>
> I've actually hacked out some code to stuff the request parameters 
> into the bean structure by hand in the form's validate method. 
> Obviously I'd like to do it automatically but I had to get the app 
> working. To try to sort out what I've done wrong, I'll strip it back 
> to the simplest bare bones and take it from there.
>
> What I can't work out from playing with your SavingMonkey demo is how 
> struts gets the request parameters into beans inside each other inside 
> the formbean. Is it necessary to instantiate the right amount of empty 
> beans first? I see SavingMonkey instantiates everything on construction.
>
> When saving request parameters to the beans in the formbean, does 
> struts call the beans' getter methods to get the ArrayLists and beans? 
> I can't see how else it would get access the setter methods on the 
> deeper nested beans.
>
> Thanks for your help. I did see a message in the archives here but I 
> can't find it again, where you were talking about changes awaiting 
> acceptance in CVS - is that just stuff that is now incorporated into 
> struts 1.1? I'm using 1.0.2
>
> All the best,
> Adam




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Re: Nested Tags question

2002-06-13 Thread Jayaraman Dorai

When I use nested tags, I am not able to access it through java scripts since the name 
is "mailingAddress.city". Does anyone have a work around or am I missing something?

Jayaraman

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 12:23 PM
To: Struts Users Mailing List
Subject: Re: Re: Nested Tags question




On Thu, 13 Jun 2002 [EMAIL PROTECTED] wrote:

> Date: Thu, 13 Jun 2002 11:43:59 +0200
> From: [EMAIL PROTECTED]
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Re: Nested Tags question
>
> So Craig,
> does the process work at submit time (when the request parameters are
> being put into the nested beans) via calls to the getter methods to get
> the beans on which the parameters have to be set?
>
> I can't see how else it would work.
>

It depends on what context you are using the expressions in.  For example:

  
  
...

...
  

will, in effect, do a call to:

  customerForm.getMailingAddress().getCity()

when the page is displayed, and a call to:

  customerForm.getMailingAddress().setCity()

when the request parameters are being copied in to the form bean.

>
> Adam
>

Craig


>
>
> "Craig R. McClanahan" <[EMAIL PROTECTED]> schrieb am 13.06.2002,
> 08:22:43:
> >
> >
> > On Thu, 13 Jun 2002, Arron Bates wrote:
> >
> > > Date: Thu, 13 Jun 2002 14:14:13 +1000
> > > From: Arron Bates
> > > Reply-To: Struts Users Mailing List
> > > To: Struts Users Mailing List
> > > Subject: Re: Nested Tags question
> > >
> > > >
> > > >
> > > >I know JSP will automatically save parameters to a javabean with the
> > > >correctly named getters and setters, but there's obviously a gap in my
> > > >knowledge because all my attempts to recreate the situation above have
> > > >failed.
> > > >
> > >
> > > Setting form properties against beans is a Struts thing, not a JSP
> > > thing. The property thing is a Bean thin and can be looked up in the
> > > JavaBean spec.
> > >
> > > The example you quote...
> > >
> > > "monkeyTeamAlpha.monkeyWorkers[0].salary"
> > >
> > > ...is a nested property. An invention implemented within Struts
> > > (Craig?).
> >
> > Yep, although in Struts 1.1 it is really a "commons-beanutils" thing
> > because we abstracted out this generally useful code into a separate
> > package.
> >
> > > What it basically is, is a string of calls rather than the
> > > single property method. Here, it will get a hold of the form bean, get a
> > > hold of the bean returned from the "monkeyTeamAlpha"property. On this
> > > bean, it will invoke the indexed property "monkeyWorkers[0]" which will
> > > pluck a bean from a collection or index provided, from this last bean it
> > > will will get a hold of its "salary" property, and set the value.
> > >
> >
> > At each stage, you also get the benefit of some intelligence that is built
> > in to the underlying PropertyUtils class.  For example, the JavaBeans spec
> > defines two ways to define an indexed property -- you can use getter and
> > setter methods that take a value and a subscript, or you can use getter
> > and setter methods that return the entire array.  PropertyUtils makes the
> > expression listed above work for either (or even for a property whose
> > value is a java.util.List, which is an extension to the JavaBeans spec).
> >
> > > All this boils down to, is that you can compose objects a little
> > > cleaner, rather than have truly enormous beans for everything. Having
> > > the indexed properties allows for lists and whatever else.
> > >
> > > The ability for nesting beans has been in Struts for a long time. The
> > > nested tags just make it much easier.
> > >
> > > There's a primer and tutorial for nested beans here...
> > >
> > > http://www.keyboardmonkey.com/next
> > >
> > > ...it should take you over creating and using such a construct.
> > >
> > > Hope this gets you on th path you're after.
> >
> > Another area of useful learning for the future is the JSP Standard Tag
> > Library (JSTL).  Although the expression language syntax supported by JSTL
> > is different from the one in Struts, it is well worth learning about --
> > this expression language will be supported anywhere in a JSP page in JSP
> > 1.3, and (in the mean time) we will likely adapt Struts tags to be able to
> > use it as well.
> >
> > >
> > >
> > > Arron.
> > >
> >
> > Craig
> >
> >
> > --
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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


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




Re: Re: Nested Tags question

2002-06-13 Thread Craig R. McClanahan



On Thu, 13 Jun 2002 [EMAIL PROTECTED] wrote:

> Date: Thu, 13 Jun 2002 11:43:59 +0200
> From: [EMAIL PROTECTED]
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Re: Nested Tags question
>
> So Craig,
> does the process work at submit time (when the request parameters are
> being put into the nested beans) via calls to the getter methods to get
> the beans on which the parameters have to be set?
>
> I can't see how else it would work.
>

It depends on what context you are using the expressions in.  For example:

  
  
...

...
  

will, in effect, do a call to:

  customerForm.getMailingAddress().getCity()

when the page is displayed, and a call to:

  customerForm.getMailingAddress().setCity()

when the request parameters are being copied in to the form bean.

>
> Adam
>

Craig


>
>
> "Craig R. McClanahan" <[EMAIL PROTECTED]> schrieb am 13.06.2002,
> 08:22:43:
> >
> >
> > On Thu, 13 Jun 2002, Arron Bates wrote:
> >
> > > Date: Thu, 13 Jun 2002 14:14:13 +1000
> > > From: Arron Bates
> > > Reply-To: Struts Users Mailing List
> > > To: Struts Users Mailing List
> > > Subject: Re: Nested Tags question
> > >
> > > >
> > > >
> > > >I know JSP will automatically save parameters to a javabean with the
> > > >correctly named getters and setters, but there's obviously a gap in my
> > > >knowledge because all my attempts to recreate the situation above have
> > > >failed.
> > > >
> > >
> > > Setting form properties against beans is a Struts thing, not a JSP
> > > thing. The property thing is a Bean thin and can be looked up in the
> > > JavaBean spec.
> > >
> > > The example you quote...
> > >
> > > "monkeyTeamAlpha.monkeyWorkers[0].salary"
> > >
> > > ...is a nested property. An invention implemented within Struts
> > > (Craig?).
> >
> > Yep, although in Struts 1.1 it is really a "commons-beanutils" thing
> > because we abstracted out this generally useful code into a separate
> > package.
> >
> > > What it basically is, is a string of calls rather than the
> > > single property method. Here, it will get a hold of the form bean, get a
> > > hold of the bean returned from the "monkeyTeamAlpha"property. On this
> > > bean, it will invoke the indexed property "monkeyWorkers[0]" which will
> > > pluck a bean from a collection or index provided, from this last bean it
> > > will will get a hold of its "salary" property, and set the value.
> > >
> >
> > At each stage, you also get the benefit of some intelligence that is built
> > in to the underlying PropertyUtils class.  For example, the JavaBeans spec
> > defines two ways to define an indexed property -- you can use getter and
> > setter methods that take a value and a subscript, or you can use getter
> > and setter methods that return the entire array.  PropertyUtils makes the
> > expression listed above work for either (or even for a property whose
> > value is a java.util.List, which is an extension to the JavaBeans spec).
> >
> > > All this boils down to, is that you can compose objects a little
> > > cleaner, rather than have truly enormous beans for everything. Having
> > > the indexed properties allows for lists and whatever else.
> > >
> > > The ability for nesting beans has been in Struts for a long time. The
> > > nested tags just make it much easier.
> > >
> > > There's a primer and tutorial for nested beans here...
> > >
> > > http://www.keyboardmonkey.com/next
> > >
> > > ...it should take you over creating and using such a construct.
> > >
> > > Hope this gets you on th path you're after.
> >
> > Another area of useful learning for the future is the JSP Standard Tag
> > Library (JSTL).  Although the expression language syntax supported by JSTL
> > is different from the one in Struts, it is well worth learning about --
> > this expression language will be supported anywhere in a JSP page in JSP
> > 1.3, and (in the mean time) we will likely adapt Struts tags to be able to
> > use it as well.
> >
> > >
> > >
> > > Arron.
> > >
> >
> > Craig
> >
> >
> > --
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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




Re: Re: Nested Tags question

2002-06-13 Thread adam . hardy

So Craig, 
does the process work at submit time (when the request parameters are
being put into the nested beans) via calls to the getter methods to get
the beans on which the parameters have to be set? 

I can't see how else it would work.


Adam



"Craig R. McClanahan" <[EMAIL PROTECTED]> schrieb am 13.06.2002,
08:22:43:
> 
> 
> On Thu, 13 Jun 2002, Arron Bates wrote:
> 
> > Date: Thu, 13 Jun 2002 14:14:13 +1000
> > From: Arron Bates 
> > Reply-To: Struts Users Mailing List 
> > To: Struts Users Mailing List 
> > Subject: Re: Nested Tags question
> >
> > >
> > >
> > >I know JSP will automatically save parameters to a javabean with the
> > >correctly named getters and setters, but there's obviously a gap in my
> > >knowledge because all my attempts to recreate the situation above have
> > >failed.
> > >
> >
> > Setting form properties against beans is a Struts thing, not a JSP
> > thing. The property thing is a Bean thin and can be looked up in the
> > JavaBean spec.
> >
> > The example you quote...
> >
> > "monkeyTeamAlpha.monkeyWorkers[0].salary"
> >
> > ...is a nested property. An invention implemented within Struts
> > (Craig?).
> 
> Yep, although in Struts 1.1 it is really a "commons-beanutils" thing
> because we abstracted out this generally useful code into a separate
> package.
> 
> > What it basically is, is a string of calls rather than the
> > single property method. Here, it will get a hold of the form bean, get a
> > hold of the bean returned from the "monkeyTeamAlpha"property. On this
> > bean, it will invoke the indexed property "monkeyWorkers[0]" which will
> > pluck a bean from a collection or index provided, from this last bean it
> > will will get a hold of its "salary" property, and set the value.
> >
> 
> At each stage, you also get the benefit of some intelligence that is built
> in to the underlying PropertyUtils class.  For example, the JavaBeans spec
> defines two ways to define an indexed property -- you can use getter and
> setter methods that take a value and a subscript, or you can use getter
> and setter methods that return the entire array.  PropertyUtils makes the
> expression listed above work for either (or even for a property whose
> value is a java.util.List, which is an extension to the JavaBeans spec).
> 
> > All this boils down to, is that you can compose objects a little
> > cleaner, rather than have truly enormous beans for everything. Having
> > the indexed properties allows for lists and whatever else.
> >
> > The ability for nesting beans has been in Struts for a long time. The
> > nested tags just make it much easier.
> >
> > There's a primer and tutorial for nested beans here...
> >
> > http://www.keyboardmonkey.com/next
> >
> > ...it should take you over creating and using such a construct.
> >
> > Hope this gets you on th path you're after.
> 
> Another area of useful learning for the future is the JSP Standard Tag
> Library (JSTL).  Although the expression language syntax supported by JSTL
> is different from the one in Struts, it is well worth learning about --
> this expression language will be supported anywhere in a JSP page in JSP
> 1.3, and (in the mean time) we will likely adapt Struts tags to be able to
> use it as well.
> 
> >
> >
> > Arron.
> >
> 
> Craig
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail:

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




Re: Nested Tags question

2002-06-12 Thread Craig R. McClanahan



On Thu, 13 Jun 2002, Arron Bates wrote:

> Date: Thu, 13 Jun 2002 14:14:13 +1000
> From: Arron Bates <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Nested Tags question
>
> >
> >
> >I know JSP will automatically save parameters to a javabean with the
> >correctly named getters and setters, but there's obviously a gap in my
> >knowledge because all my attempts to recreate the situation above have
> >failed.
> >
>
> Setting form properties against beans is a Struts thing, not a JSP
> thing. The property thing is a Bean thin and can be looked up in the
> JavaBean spec.
>
> The example you quote...
>
> "monkeyTeamAlpha.monkeyWorkers[0].salary"
>
> ...is a nested property. An invention implemented within Struts
> (Craig?).

Yep, although in Struts 1.1 it is really a "commons-beanutils" thing
because we abstracted out this generally useful code into a separate
package.

> What it basically is, is a string of calls rather than the
> single property method. Here, it will get a hold of the form bean, get a
> hold of the bean returned from the "monkeyTeamAlpha"property. On this
> bean, it will invoke the indexed property "monkeyWorkers[0]" which will
> pluck a bean from a collection or index provided, from this last bean it
> will will get a hold of its "salary" property, and set the value.
>

At each stage, you also get the benefit of some intelligence that is built
in to the underlying PropertyUtils class.  For example, the JavaBeans spec
defines two ways to define an indexed property -- you can use getter and
setter methods that take a value and a subscript, or you can use getter
and setter methods that return the entire array.  PropertyUtils makes the
expression listed above work for either (or even for a property whose
value is a java.util.List, which is an extension to the JavaBeans spec).

> All this boils down to, is that you can compose objects a little
> cleaner, rather than have truly enormous beans for everything. Having
> the indexed properties allows for lists and whatever else.
>
> The ability for nesting beans has been in Struts for a long time. The
> nested tags just make it much easier.
>
> There's a primer and tutorial for nested beans here...
>
> http://www.keyboardmonkey.com/next
>
> ...it should take you over creating and using such a construct.
>
> Hope this gets you on th path you're after.

Another area of useful learning for the future is the JSP Standard Tag
Library (JSTL).  Although the expression language syntax supported by JSTL
is different from the one in Struts, it is well worth learning about --
this expression language will be supported anywhere in a JSP page in JSP
1.3, and (in the mean time) we will likely adapt Struts tags to be able to
use it as well.

>
>
> Arron.
>

Craig


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




Re: Nested Tags question

2002-06-12 Thread Adam Hardy

Hi Down Under,

thanks for the reply. I figured that the form properties setting thing 
must be struts, after checking out the JSP spec. JSP does do a certain 
amount of it though, since you can specify a tag in your jsp and say 
parameters="*" - and JSP will match any parameters in the request to 
methods on the tag's bean.

Anyway sorry for sounding like such a dumbass but I've been through your 
tutorials. For the display, I've got the nested tags sussed - it's for 
the save on submit that I'm having problems. It's one of those 
aggravating problems that I can't pin down so it's difficult to ask the 
right questions.

I've actually hacked out some code to stuff the request parameters into 
the bean structure by hand in the form's validate method. Obviously I'd 
like to do it automatically but I had to get the app working. To try to 
sort out what I've done wrong, I'll strip it back to the simplest bare 
bones and take it from there.

What I can't work out from playing with your SavingMonkey demo is how 
struts gets the request parameters into beans inside each other inside 
the formbean. Is it necessary to instantiate the right amount of empty 
beans first? I see SavingMonkey instantiates everything on construction.

When saving request parameters to the beans in the formbean, does struts 
call the beans' getter methods to get the ArrayLists and beans? I can't 
see how else it would get access the setter methods on the deeper nested 
beans.

Thanks for your help. I did see a message in the archives here but I 
can't find it again, where you were talking about changes awaiting 
acceptance in CVS - is that just stuff that is now incorporated into 
struts 1.1? I'm using 1.0.2

All the best,
Adam

Arron Bates wrote:

>>
>>
>> I know JSP will automatically save parameters to a javabean with the
>> correctly named getters and setters, but there's obviously a gap in my
>> knowledge because all my attempts to recreate the situation above have
>> failed.
>
>
> Setting form properties against beans is a Struts thing, not a JSP 
> thing. The property thing is a Bean thin and can be looked up in the 
> JavaBean spec.
>
> The example you quote...
>
>"monkeyTeamAlpha.monkeyWorkers[0].salary"
>
>...is a nested property. An invention implemented within Struts 
> (Craig?). What it basically is, is a string of calls rather than the 
> single property method. Here, it will get a hold of the form bean, get 
> a hold of the bean returned from the "monkeyTeamAlpha"property. On 
> this bean, it will invoke the indexed property "monkeyWorkers[0]" 
> which will pluck a bean from a collection or index provided, from this 
> last bean it will will get a hold of its "salary" property, and set 
> the value.
>
> All this boils down to, is that you can compose objects a little 
> cleaner, rather than have truly enormous beans for everything. Having 
> the indexed properties allows for lists and whatever else.
>
> The ability for nesting beans has been in Struts for a long time. The 
> nested tags just make it much easier.
>
> There's a primer and tutorial for nested beans here...
>
>http://www.keyboardmonkey.com/next
>
>...it should take you over creating and using such a construct.
>
> Hope this gets you on th path you're after.
>
>
> Arron.
>
>
> -- 
> To unsubscribe, e-mail:   
> 
> For additional commands, e-mail: 
> 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested Tags question

2002-06-12 Thread Arron Bates

Adam,

Should say that the monkey example's not the mos simple example. It's 
more of a "what's possible" than a learners tool.

I just posted the link to the tute's and primer. The Tute's walk through 
from a plain, non-nested bean, to the initial nesting, to the lists, and 
lists within lists... I'd recommend going that way. For convenience, 
that link again...

http://www.keyboardmonkey.com/next

A couple of people have had a stumbling start because they found the 
monkey example first and love to hack that than take the walking tour. 
I'm considering removing it from the nesting-newbie eye.

If you have any more issues or questiong, you know where we are...


Arron.


[EMAIL PROTECTED] wrote:

>Hi All,
>I am trying to save a list created with the nested:iterate tag (from an
>object array in my form bean). I've written my code by following the
>SaveMonkey example from Arron Bates' KeyboardMonkey site (kudos to you,
>capt'n) - but the object array doesn't get recreated on a submit!
>
>Can I use a nested:iterate tag on an array straight out of the form
>bean? That seems to be the only difference I can see between mine and
>the SaveMonkey demo.
>
>The setList(Object[] newList) isn't working. Struts or Tomcat isn't
>recognising it as a normal javabean property setter I guess. Here's what
>the HTML looks like:
>
>action="/apla/operationList.do">
>  
>
>
>
>Should I keep looking for a bug that's stopping the setList() method
>from being recognised as a setter method?
>
>Thanks if you can help,
>Adam
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested Tags question

2002-06-12 Thread Arron Bates

>
>
>I know JSP will automatically save parameters to a javabean with the
>correctly named getters and setters, but there's obviously a gap in my
>knowledge because all my attempts to recreate the situation above have
>failed. 
>

Setting form properties against beans is a Struts thing, not a JSP 
thing. The property thing is a Bean thin and can be looked up in the 
JavaBean spec.

The example you quote...

"monkeyTeamAlpha.monkeyWorkers[0].salary"

...is a nested property. An invention implemented within Struts 
(Craig?). What it basically is, is a string of calls rather than the 
single property method. Here, it will get a hold of the form bean, get a 
hold of the bean returned from the "monkeyTeamAlpha"property. On this 
bean, it will invoke the indexed property "monkeyWorkers[0]" which will 
pluck a bean from a collection or index provided, from this last bean it 
will will get a hold of its "salary" property, and set the value.

All this boils down to, is that you can compose objects a little 
cleaner, rather than have truly enormous beans for everything. Having 
the indexed properties allows for lists and whatever else.

The ability for nesting beans has been in Struts for a long time. The 
nested tags just make it much easier.

There's a primer and tutorial for nested beans here...

http://www.keyboardmonkey.com/next

...it should take you over creating and using such a construct.

Hope this gets you on th path you're after.


Arron.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested Tags question

2002-06-12 Thread adam . hardy

Hi folks,
I'm going nuts & having a very unproductive day here trying to save
these nested tags as I mentioned earlier. I've boiled down my ignorance
so to speak to the following question:

How or why is the following input tag name / http request param:

monkeyTeamAlpha.monkeyWorkers[0].salary

saved to the MonkeyBean object within an ArrayList monkeyList within a
MonkeyTeamBean within the formbean?

I know JSP will automatically save parameters to a javabean with the
correctly named getters and setters, but there's obviously a gap in my
knowledge because all my attempts to recreate the situation above have
failed. 

I'll go off and try to find something in Sun's JSP specification, but if
anyone can give me a clue, I'd be massively grateful. 

Thanks
Adam



[EMAIL PROTECTED] schrieb am 12.06.2002, 15:15:30:
> Hi All,
> I am trying to save a list created with the nested:iterate tag (from an
> object array in my form bean). I've written my code by following the
> SaveMonkey example from Arron Bates' KeyboardMonkey site (kudos to you,
> capt'n) - but the object array doesn't get recreated on a submit!
> 
> Can I use a nested:iterate tag on an array straight out of the form
> bean? That seems to be the only difference I can see between mine and
> the SaveMonkey demo.
> 
> The setList(Object[] newList) isn't working. Struts or Tomcat isn't
> recognising it as a normal javabean property setter I guess. Here's what
> the HTML looks like:
> 
> 
>   
> 
> 
> 
> Should I keep looking for a bug that's stopping the setList() method
> from being recognised as a setter method?
> 
> Thanks if you can help,
> Adam
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail:

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: nested tags question

2002-04-14 Thread Arron Bates
The nested tags as of probably a month and a half ago, the nested tags
penetrate dynamic includes.
I tried to mail the few (but vocal :) people that were throwing things
at me to get it done, you may have been the one that got away. Apologies.

Putting up a tutorial on my site tonight to show the potential of true
recursion and JSP's to make a tree structure. Trees have never been more
fun. :)

Arron.


Alex Paransky wrote:

>You should be able to do that.  In-fact, that's one of the ways to re-use
>common page presentations.  If you do your job write, then your main page is
>composed of a bunch of includes to render different parts of the result
>"tree".  Be-careful, however, the last time I checked the nested tags only
>work well in a static include scenario.  They don't work well with dynamic
>includes, which is what you might find you need to do, if you have a lot of
>conditionals (otherwise, it's very easy to exceed to the 64K method limit).
>
>-AP_
>http://www.alexparansky.com
>Java/J2EE Architect/Consultant
>http://www.myprofiles.com/member/view.do?profileId=127
>
>-Original Message-
>From: Kousek, Theron [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, April 11, 2002 2:33 PM
>To: 'Struts Users Mailing List'
>Subject: nested tags question
>
>
>
>Hi folks:
>
>I have a few forms that contain the same type of "template"...   I want to
>create a generic template that uses a form bean.   This template needs to
>handle form beans that are at the root level or a form bean that may be
>nested.
>
>So in one screen, the template will be at the root and not need to be
>nested.  In another screen, the same template will need to be nested.  So
>basically, I can contain my nested statements like:
>
>
>   
>
>outside the scope of the template and in the file that needs to invoke the
>template...
>The actual template can contain the :
>
>   
>   property="displayBillid"
>   disabled="true"
>   size="10" styleId="small"/>
>   
>
>type tags...
>So here's my question:
>
>Even if a form bean is at the root and not nested at all, can I still
>declare it to be nested, only define it at the root?  So billingForm for
>example could be:
>
>
>even if it is at the topmost level?   Is this normal or should I avoid it?
>If this is legal, then I will be able to literally plug and play these
>templates into other screens and will have one common layout repository.
>
>thanks,
>Theron
>
>--
>To unsubscribe, e-mail:
>
>For additional commands, e-mail:
>
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


RE: nested tags question

2002-04-14 Thread Alex Paransky
You should be able to do that.  In-fact, that's one of the ways to re-use
common page presentations.  If you do your job write, then your main page is
composed of a bunch of includes to render different parts of the result
"tree".  Be-careful, however, the last time I checked the nested tags only
work well in a static include scenario.  They don't work well with dynamic
includes, which is what you might find you need to do, if you have a lot of
conditionals (otherwise, it's very easy to exceed to the 64K method limit).

-AP_
http://www.alexparansky.com
Java/J2EE Architect/Consultant
http://www.myprofiles.com/member/view.do?profileId=127

-Original Message-
From: Kousek, Theron [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 2:33 PM
To: 'Struts Users Mailing List'
Subject: nested tags question



Hi folks:

I have a few forms that contain the same type of "template"...   I want to
create a generic template that uses a form bean.   This template needs to
handle form beans that are at the root level or a form bean that may be
nested.

So in one screen, the template will be at the root and not need to be
nested.  In another screen, the same template will need to be nested.  So
basically, I can contain my nested statements like:




outside the scope of the template and in the file that needs to invoke the
template...
The actual template can contain the :





type tags...
So here's my question:

Even if a form bean is at the root and not nested at all, can I still
declare it to be nested, only define it at the root?  So billingForm for
example could be:


even if it is at the topmost level?   Is this normal or should I avoid it?
If this is legal, then I will be able to literally plug and play these
templates into other screens and will have one common layout repository.

thanks,
Theron

--
To unsubscribe, e-mail:

For additional commands, e-mail:




--
To unsubscribe, e-mail:   
For additional commands, e-mail: