You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Graham Leggett <mi...@sharp.fm> on 2003/05/23 13:36:53 UTC

Example of in use

Hi all,

Can anyone give me an example JSP of where the <html:select> tag is used 
to render a multiple select box from a provided java.util.List? I have 
trawled the docs, but they are too vague to be useful.

The docs claim that the "name" property allows the select box to be 
pre-populated with select/deselect information, but this is not enough 
information. How do I specify the property of the bean referred to by 
name, and how do I specify the type of that property? And what should 
the contents of that property be in order for the selectbox to be 
considered selected?

Does the <html:select> tag iterate through all the options? The docs are 
not clear on whether I need to do this, or whether I need to use an 
<logic:iterate> tag as well.

Any clues?

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


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


Re: Example of in use

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "James" == James Mitchell <jm...@apache.org> writes:

    >> From a "how do I" documentation standpoint, anyone is free to open the jsp
    James> files from the test suite and see how different configurations of a
    James> particular tag work and are tested.  I'm just not sure how all this could be
    James> done with the current taglib tests. (At least the ones I've done)

    James> I have quite a bit more to do on the current tests and I'm certainly open to
    James> suggestions.  I chose to setup the tests to utilize the framework and
    James> container in a more natural way (setting up and forwarding to jsp
    James> pages)....instead of trying to duplicate what the container does.  Sure,
    James> this requires a bit more overhead with page compilation, but, IMHO, I think
    James> it's worth the trade off.

There's very little reason to worry about the "overhead" of page compilation in
the automated unit tests.  Speed is not necessary here.  In addition, tests of
JSP custom tags which avoid the step of compiling JSP pages which use those
tags are not much of a test, in my view.

It's a little late to mention this, but I would have suggested (actually I
think I did once, briefly) that the Struts tag automated tests could be even
more robust.  In my own work, I've started to adapt the approach of forwarding
to a small test page, as you are, but I'm also putting code in the "end"
methods which use the HttpUnit WebResponse class to get the DOM for the
response, and use Xalan's XPath API to really verify that the structure and
attributes of the result is exactly what I expected.  I did some of this in
some of the Struts-EL tests, although I hadn't started using your simple test
page idea (I was manually creating the tag objects at that time).

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




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


Re: Example of in use

Posted by James Mitchell <jm...@apache.org>.
----- Original Message -----
From: "Ted Husted" <hu...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, May 31, 2003 7:48 AM
Subject: Re: Example of <html:select> in use


> James Mitchell wrote:
> > In a way, I was hoping the test cases I wrote recently would sort-of
take care
> > of this.  Although they are not as newbie friendly as a nice deployable
war,
> > they demonstrate the before and after souce view of (more or less) every
> > possible configuration of every tag.
> >
> > They need a bit of refactoring and they are not complete for every tag
(yet),
> > but I think I got a nice start on them and I hope to have the time soon
to
> > finish them.
>
> I wonder if we could set it up so that the taglib test classes can be
> complied into a special taglib-exercise JAR and bundled with the
> exercise application (source and all). We might then be able to pick
> some of the key tests and present the source code, as Steve is doing.
>
> So there would be both the test pages and the JUnit tests in the
> exercise WAR.
>
> The goal here would be to show people how taglibs can be tested, and
> also to show people how we are testing our taglibs [in case they want to
> pitch in =:0)]. We might also add the other tests sometime, so that this
> becomes a complete testing application for Struts.
>
> So, we'd have the MailReader example showing Struts being used to solve
> a specific business problem, Steve's "Struts University" examples
> showing how to implement various use-cases, the exercise application
> with our unit tests, and the Tiles and Validator examples.
>
> At some point the Struts University examples might absorb the Tiles and
> Validator examples, so we could have just the three (MailReader,
> University, and Exercise).
>
> Of course, there might still be others in contrib, for the JSF tags and
> other optional packages.
>
> -Ted.
>

>From a "how do I" documentation standpoint, anyone is free to open the jsp
files from the test suite and see how different configurations of a
particular tag work and are tested.  I'm just not sure how all this could be
done with the current taglib tests. (At least the ones I've done)

I have quite a bit more to do on the current tests and I'm certainly open to
suggestions.  I chose to setup the tests to utilize the framework and
container in a more natural way (setting up and forwarding to jsp
pages)....instead of trying to duplicate what the container does.  Sure,
this requires a bit more overhead with page compilation, but, IMHO, I think
it's worth the trade off.

Comments?

James Mitchell





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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
James Mitchell wrote:
> In a way, I was hoping the test cases I wrote recently would sort-of take care 
> of this.  Although they are not as newbie friendly as a nice deployable war, 
> they demonstrate the before and after souce view of (more or less) every 
> possible configuration of every tag.
> 
> They need a bit of refactoring and they are not complete for every tag (yet), 
> but I think I got a nice start on them and I hope to have the time soon to 
> finish them.

I wonder if we could set it up so that the taglib test classes can be 
complied into a special taglib-exercise JAR and bundled with the 
exercise application (source and all). We might then be able to pick 
some of the key tests and present the source code, as Steve is doing.

So there would be both the test pages and the JUnit tests in the 
exercise WAR.

The goal here would be to show people how taglibs can be tested, and 
also to show people how we are testing our taglibs [in case they want to 
pitch in =:0)]. We might also add the other tests sometime, so that this 
becomes a complete testing application for Struts.

So, we'd have the MailReader example showing Struts being used to solve 
a specific business problem, Steve's "Struts University" examples 
showing how to implement various use-cases, the exercise application 
with our unit tests, and the Tiles and Validator examples.

At some point the Struts University examples might absorb the Tiles and 
Validator examples, so we could have just the three (MailReader, 
University, and Exercise).

Of course, there might still be others in contrib, for the JSF tags and 
other optional packages.

-Ted.



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


Re: Example of in use

Posted by Phil Steitz <ph...@steitz.com>.
Ted Husted wrote:
> James Mitchell wrote:
> 
>> In a way, I was hoping the test cases I wrote recently would sort-of 
>> take care of this.  Although they are not as newbie friendly as a nice 
>> deployable war, they demonstrate the before and after souce view of 
>> (more or less) every possible configuration of every tag.
>>
>> They need a bit of refactoring and they are not complete for every tag 
>> (yet), but I think I got a nice start on them and I hope to have the 
>> time soon to finish them.
> 
> 
> Yes, it would be a good idea for an examples application to do 
> double-duty as a vehicle for unit testing. Someone might try to roll 
> runtime unit tests and the exercise taglibs into a coherent examples 
> application.

These are also useful in performance testing. I have been running some 
tests using James' unit tests to evaluate performance of the tags using 
different containers.  I will post results once I have a little more 
confidence in them. I agree that with a little thought you could 
probably assemble a nice "triple-duty" (unit test, illustration, 
benchmark) samples bundle from what you already have. This would be a 
good thing.

> 
> The end-game being when people ask for an "example of <html:select> 
> use", we can say "see the <html:select> example in the examples 
> application", and feel good about it. =:0)
> 
> The <html:select> example in the exercise-taglibs application is quite 
> nice, except that it does not use an Action to generate the data. This 
> makes it harder to see the forest for the trees. (And doesn't 
> demonstrate best practices.)
> 
> So while, it's a very fine test page (as intended), it's only a mediocre 
> example page. I'll continue to point people there when they ask, but 
> with lingering regret.
> 
> As mentioned, a generic "Struts Examples" application, using pages and 
> Actions together, would be a very good exercise for someone learning to 
> use Struts, especially if they need to turn around and teach Struts to 
> their team.
> 
> -Ted.
> 
> 
> 




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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
Steve,

Well, I'd say that's pretty much perfect =:0)

Why don't you finish what you started here, and then we can talk about 
getting it into the distribution, if that's what you would like.

I just realized that we don't emphasize the bundled applications on the 
Learning page.

http://jakarta.apache.org/struts/learning.html

I'll change this to mention the MailReader and other example 
applications, and then go onto talk about the documentation WAR. 
Learning from example has always been a key part of Struts, and we 
should get back to those roots.

The core list you've setup seems quite good, though I might be tempted 
to add "multiple submit buttons". Of course, there could be many, many 
more examples, but these 11 (or 12), I think, make for a good "Struts 
101". If we can come up with some more of these later, we can start 
adding additional index pages, with up to another dozen on each page.

[Can't wait to see how the announcement will read. IMHO, groking these 
examples would certainly make a developer a more attractive team member 
=:0)].

BTW, I don't see an Ant buildfile in the WAR. Would you like me to set 
one up and send it over?

-Ted.


Steve Raeburn wrote:
> I've made a start on a Struts examples application, similar to the Tomcat
> examples. You might find it looks a bit familiar ;-)
> 
> I would appreciate some feedback on whether this is the kind of thing you
> had in mind. Should I carry on with this or am I completely off-base?
> 
> You can view the results so far at
> http://bobcat.webappcabaret.net/ninsky/index.jsp. You can view the source
> online (wouldn't  be a very good sample app otherwise, would it?)
> 
> If you think it's going to be useful, please offer any suggestions as to
> what to add. If anyone wants to play with it you can download the war at
> http://bobcat.webappcabaret.net/ninsky/download/ninsky.war
> 
> Steve






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


RE: Example of in use

Posted by Steve Raeburn <st...@ninsky.com>.
Yup, just a 15 day trial site but they didn't tell me when it expired or I
might have actually given them some money.

Anyway, the latest version can be downloaded at www.ninsky.com/struts/ Not
running live this time, just a WAR to download.
IMHO it provides a compendium of reasonably useful examples -- I've found
myself referring back to it a couple of times so there's at least one
satisfied customer :-)

If you think it's OK, let me know what you want to do with it and what I
should do next.

Steve


> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: June 21, 2003 1:06 PM
> To: Struts Users Mailing List
> Subject: Re: Example of <html:select> in use
>
>
> So, you still working on this, Steve?
>
> I notice that the link seems to be down.
>
> -T.
>
> Steve Raeburn wrote:
> > I've made a start on a Struts examples application, similar to
> the Tomcat
> > examples. You might find it looks a bit familiar ;-)
> >
> > I would appreciate some feedback on whether this is the kind of
> thing you
> > had in mind. Should I carry on with this or am I completely off-base?
> >
> > You can view the results so far at
> > http://bobcat.webappcabaret.net/ninsky/index.jsp. You can view
> the source
> > online (wouldn't  be a very good sample app otherwise, would it?)
> >
> > If you think it's going to be useful, please offer any suggestions as to
> > what to add. If anyone wants to play with it you can download the war at
> > http://bobcat.webappcabaret.net/ninsky/download/ninsky.war
> >
> > Steve
> >
> >
> >>-----Original Message-----
> >>From: Ted Husted [mailto:husted@apache.org]
> >>Sent: May 25, 2003 2:16 PM
> >>To: Struts Users Mailing List
> >>Subject: Re: Example of <html:select> in use
> >>
> >>
> >>James Mitchell wrote:
> >>
> >>>In a way, I was hoping the test cases I wrote recently would
> >>
> >>sort-of take care
> >>
> >>>of this.  Although they are not as newbie friendly as a nice
> >>
> >>deployable war,
> >>
> >>>they demonstrate the before and after souce view of (more or
> >>
> >>less) every
> >>
> >>>possible configuration of every tag.
> >>>
> >>>They need a bit of refactoring and they are not complete for
> >>
> >>every tag (yet),
> >>
> >>>but I think I got a nice start on them and I hope to have the
> >>
> >>time soon to
> >>
> >>>finish them.
> >>
> >>Yes, it would be a good idea for an examples application to do
> >>double-duty as a vehicle for unit testing. Someone might try to roll
> >>runtime unit tests and the exercise taglibs into a coherent examples
> >>application.
> >>
> >>The end-game being when people ask for an "example of <html:select>
> >>use", we can say "see the <html:select> example in the examples
> >>application", and feel good about it. =:0)
> >>
> >>The <html:select> example in the exercise-taglibs application is quite
> >>nice, except that it does not use an Action to generate the data. This
> >>makes it harder to see the forest for the trees. (And doesn't
> >>demonstrate best practices.)
> >>
> >>So while, it's a very fine test page (as intended), it's only a mediocre
> >>example page. I'll continue to point people there when they ask, but
> >>with lingering regret.
> >>
> >>As mentioned, a generic "Struts Examples" application, using pages and
> >>Actions together, would be a very good exercise for someone learning to
> >>use Struts, especially if they need to turn around and teach Struts to
> >>their team.
> >>
> >>-Ted.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
So, you still working on this, Steve?

I notice that the link seems to be down.

-T.

Steve Raeburn wrote:
> I've made a start on a Struts examples application, similar to the Tomcat
> examples. You might find it looks a bit familiar ;-)
> 
> I would appreciate some feedback on whether this is the kind of thing you
> had in mind. Should I carry on with this or am I completely off-base?
> 
> You can view the results so far at
> http://bobcat.webappcabaret.net/ninsky/index.jsp. You can view the source
> online (wouldn't  be a very good sample app otherwise, would it?)
> 
> If you think it's going to be useful, please offer any suggestions as to
> what to add. If anyone wants to play with it you can download the war at
> http://bobcat.webappcabaret.net/ninsky/download/ninsky.war
> 
> Steve
> 
> 
>>-----Original Message-----
>>From: Ted Husted [mailto:husted@apache.org]
>>Sent: May 25, 2003 2:16 PM
>>To: Struts Users Mailing List
>>Subject: Re: Example of <html:select> in use
>>
>>
>>James Mitchell wrote:
>>
>>>In a way, I was hoping the test cases I wrote recently would
>>
>>sort-of take care
>>
>>>of this.  Although they are not as newbie friendly as a nice
>>
>>deployable war,
>>
>>>they demonstrate the before and after souce view of (more or
>>
>>less) every
>>
>>>possible configuration of every tag.
>>>
>>>They need a bit of refactoring and they are not complete for
>>
>>every tag (yet),
>>
>>>but I think I got a nice start on them and I hope to have the
>>
>>time soon to
>>
>>>finish them.
>>
>>Yes, it would be a good idea for an examples application to do
>>double-duty as a vehicle for unit testing. Someone might try to roll
>>runtime unit tests and the exercise taglibs into a coherent examples
>>application.
>>
>>The end-game being when people ask for an "example of <html:select>
>>use", we can say "see the <html:select> example in the examples
>>application", and feel good about it. =:0)
>>
>>The <html:select> example in the exercise-taglibs application is quite
>>nice, except that it does not use an Action to generate the data. This
>>makes it harder to see the forest for the trees. (And doesn't
>>demonstrate best practices.)
>>
>>So while, it's a very fine test page (as intended), it's only a mediocre
>>example page. I'll continue to point people there when they ask, but
>>with lingering regret.
>>
>>As mentioned, a generic "Struts Examples" application, using pages and
>>Actions together, would be a very good exercise for someone learning to
>>use Struts, especially if they need to turn around and teach Struts to
>>their team.
>>
>>-Ted.





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


RE: Example of in use

Posted by Steve Raeburn <st...@ninsky.com>.
I've made a start on a Struts examples application, similar to the Tomcat
examples. You might find it looks a bit familiar ;-)

I would appreciate some feedback on whether this is the kind of thing you
had in mind. Should I carry on with this or am I completely off-base?

You can view the results so far at
http://bobcat.webappcabaret.net/ninsky/index.jsp. You can view the source
online (wouldn't  be a very good sample app otherwise, would it?)

If you think it's going to be useful, please offer any suggestions as to
what to add. If anyone wants to play with it you can download the war at
http://bobcat.webappcabaret.net/ninsky/download/ninsky.war

Steve

> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: May 25, 2003 2:16 PM
> To: Struts Users Mailing List
> Subject: Re: Example of <html:select> in use
>
>
> James Mitchell wrote:
> > In a way, I was hoping the test cases I wrote recently would
> sort-of take care
> > of this.  Although they are not as newbie friendly as a nice
> deployable war,
> > they demonstrate the before and after souce view of (more or
> less) every
> > possible configuration of every tag.
> >
> > They need a bit of refactoring and they are not complete for
> every tag (yet),
> > but I think I got a nice start on them and I hope to have the
> time soon to
> > finish them.
>
> Yes, it would be a good idea for an examples application to do
> double-duty as a vehicle for unit testing. Someone might try to roll
> runtime unit tests and the exercise taglibs into a coherent examples
> application.
>
> The end-game being when people ask for an "example of <html:select>
> use", we can say "see the <html:select> example in the examples
> application", and feel good about it. =:0)
>
> The <html:select> example in the exercise-taglibs application is quite
> nice, except that it does not use an Action to generate the data. This
> makes it harder to see the forest for the trees. (And doesn't
> demonstrate best practices.)
>
> So while, it's a very fine test page (as intended), it's only a mediocre
> example page. I'll continue to point people there when they ask, but
> with lingering regret.
>
> As mentioned, a generic "Struts Examples" application, using pages and
> Actions together, would be a very good exercise for someone learning to
> use Struts, especially if they need to turn around and teach Struts to
> their team.
>
> -Ted.
>
>
>
> --
> Ted Husted,
> Struts in Action <http://husted.com/struts/book.html>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
James Mitchell wrote:
> In a way, I was hoping the test cases I wrote recently would sort-of take care 
> of this.  Although they are not as newbie friendly as a nice deployable war, 
> they demonstrate the before and after souce view of (more or less) every 
> possible configuration of every tag.
> 
> They need a bit of refactoring and they are not complete for every tag (yet), 
> but I think I got a nice start on them and I hope to have the time soon to 
> finish them.

Yes, it would be a good idea for an examples application to do 
double-duty as a vehicle for unit testing. Someone might try to roll 
runtime unit tests and the exercise taglibs into a coherent examples 
application.

The end-game being when people ask for an "example of <html:select> 
use", we can say "see the <html:select> example in the examples 
application", and feel good about it. =:0)

The <html:select> example in the exercise-taglibs application is quite 
nice, except that it does not use an Action to generate the data. This 
makes it harder to see the forest for the trees. (And doesn't 
demonstrate best practices.)

So while, it's a very fine test page (as intended), it's only a mediocre 
example page. I'll continue to point people there when they ask, but 
with lingering regret.

As mentioned, a generic "Struts Examples" application, using pages and 
Actions together, would be a very good exercise for someone learning to 
use Struts, especially if they need to turn around and teach Struts to 
their team.

-Ted.



-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


Re: Example of in use

Posted by James Mitchell <jm...@apache.org>.
On Sunday 25 May 2003 13:28, Ted Husted wrote:
> James Mitchell wrote:
>  > What kind of examples do you have in mind?
>
> I've always thought something like the Tomcat Examples, but focused on
> business use cases would be helpful. A good starting place might be to
> take the Struts exercise-taglib application and refactor them to use
> Actions rather than Model 1 test pages. The DynaActionForms would be
> very useful for examples like these. [So if your boss lets you tithe,
> Mark, here's a place you could dive in =:)]

In a way, I was hoping the test cases I wrote recently would sort-of take care 
of this.  Although they are not as newbie friendly as a nice deployable war, 
they demonstrate the before and after souce view of (more or less) every 
possible configuration of every tag.

They need a bit of refactoring and they are not complete for every tag (yet), 
but I think I got a nice start on them and I hope to have the time soon to 
finish them.

>
> -Ted.
>
> > On Saturday 24 May 2003 07:06, Ted Husted wrote:
> >>For some working examples, see the MailReader example application as
> >>well as the exercise-taglib applications.
> >>
> >>We could use some better working examples. If anyone wants to start a
> >>struts-examples application to help demonstrate the tags, we'd be happy
> >>to have one in the distribution.
> >>
> >>-Ted.

-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.Struts-Atlanta.org


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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
I'd suggest starting with the taglibs-exercise application but changing 
it to use DynaActionForms and Actions (like real life) instead of 
creating the objects on the page.

Once we hit the low-hanging fruit, we could add some more interesting 
use-cases, like scrolling with the pager taglib, for example.

-Ted.

Steve Raeburn wrote:
> I was thinking of putting together a simple example using a DynaAction form
> to demonstrate various tags (particularly options as they have always
> confused me!). I had envisaged -
> 
> prepareFormAction -> Form.jsp -> processFormAction -> Results.jsp
> 
> If I include all the input tags on this form, would be of any use as an
> useful as an example? If anyone is interested I can hack something out
> today.
> 
> I liked Ted's suggestion of something similar to the Tomcat examples, but
> having multiple forms / actions might
> be more confusing for a beginner than one form showing all the different
> types. What do you think?
> 
> Steve
> 
> -----Original Message-----
> From: Graham Leggett [mailto:minfrin@sharp.fm]
> Sent: May 26, 2003 3:29 AM
> To: Struts Users Mailing List
> Subject: Re: Example of <html:select> in use
> 
> 
> James Mitchell wrote:
> 
> 
>>What kind of examples do you have in mind?
> 
> 
> Ideally what would have helped me would have been specific and
> individual examples of each technology being used, rather than just an
> example of everything used together.
> 
> It's a bit like asking for an example of a violin, and someone giving
> you an example of an orchestra and saying "there you go".
> 
> A great example would be one to show the use of DynaActionForms, with a
> sample JSP page showing how the fields in the actionform are used by the
> elements in the JSP.
> 
> Regards,
> Graham
> --
> -----------------------------------------
> minfrin@sharp.fm		"There's a moon
> 					over Bourbon Street
> 						tonight..."
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


RE: Example of in use

Posted by Steve Raeburn <st...@ninsky.com>.
I was thinking of putting together a simple example using a DynaAction form
to demonstrate various tags (particularly options as they have always
confused me!). I had envisaged -

prepareFormAction -> Form.jsp -> processFormAction -> Results.jsp

If I include all the input tags on this form, would be of any use as an
useful as an example? If anyone is interested I can hack something out
today.

I liked Ted's suggestion of something similar to the Tomcat examples, but
having multiple forms / actions might
be more confusing for a beginner than one form showing all the different
types. What do you think?

Steve

-----Original Message-----
From: Graham Leggett [mailto:minfrin@sharp.fm]
Sent: May 26, 2003 3:29 AM
To: Struts Users Mailing List
Subject: Re: Example of <html:select> in use


James Mitchell wrote:

> What kind of examples do you have in mind?

Ideally what would have helped me would have been specific and
individual examples of each technology being used, rather than just an
example of everything used together.

It's a bit like asking for an example of a violin, and someone giving
you an example of an orchestra and saying "there you go".

A great example would be one to show the use of DynaActionForms, with a
sample JSP page showing how the fields in the actionform are used by the
elements in the JSP.

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


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



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


Re: Example of in use

Posted by Graham Leggett <mi...@sharp.fm>.
James Mitchell wrote:

> What kind of examples do you have in mind?

Ideally what would have helped me would have been specific and 
individual examples of each technology being used, rather than just an 
example of everything used together.

It's a bit like asking for an example of a violin, and someone giving 
you an example of an orchestra and saying "there you go".

A great example would be one to show the use of DynaActionForms, with a 
sample JSP page showing how the fields in the actionform are used by the 
elements in the JSP.

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
James Mitchell wrote:
 > What kind of examples do you have in mind?

I've always thought something like the Tomcat Examples, but focused on 
business use cases would be helpful. A good starting place might be to 
take the Struts exercise-taglib application and refactor them to use 
Actions rather than Model 1 test pages. The DynaActionForms would be 
very useful for examples like these. [So if your boss lets you tithe, 
Mark, here's a place you could dive in =:)]

-Ted.


> On Saturday 24 May 2003 07:06, Ted Husted wrote:
> 
>>For some working examples, see the MailReader example application as
>>well as the exercise-taglib applications.
>>
>>We could use some better working examples. If anyone wants to start a
>>struts-examples application to help demonstrate the tags, we'd be happy
>>to have one in the distribution.
> 
>>-Ted.
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


Re: Example of in use

Posted by James Mitchell <jm...@apache.org>.
On Saturday 24 May 2003 07:06, Ted Husted wrote:
> For some working examples, see the MailReader example application as
> well as the exercise-taglib applications.
>
> We could use some better working examples. If anyone wants to start a
> struts-examples application to help demonstrate the tags, we'd be happy
> to have one in the distribution.

What kind of examples do you have in mind?

>
> -Ted.

-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.Struts-Atlanta.org


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


Re: Example of in use

Posted by Ted Husted <hu...@apache.org>.
For some working examples, see the MailReader example application as 
well as the exercise-taglib applications.

We could use some better working examples. If anyone wants to start a 
struts-examples application to help demonstrate the tags, we'd be happy 
to have one in the distribution.

-Ted.


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


Re: Example of in use

Posted by Graham Leggett <mi...@sharp.fm>.
Caroline Holanda wrote:

>   I've just finished one work that implements this.
> Let's try to explain you.

This is exactly what I needed, thanks!

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


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


Re: Example of in use

Posted by Caroline Holanda <sp...@yahoo.com>.
Graham,

  I've just finished one work that implements this.
Let's try to explain you.

  The first thing, you need to define two fields in
your form for each select element you have in your
page: one to receive the selected itens and other that
have the list of possible value. Write like this in
the Struts-config.xml file:
  <form-beans>
    <form-bean name="editForm"
type="org.apache.struts.action.DynaActionForm">
       <form-property name="selectedList"
type="java.lang.String[]"/>
       <form-property name="listColl"
type="java.util.Collection"/>       
    </form-bean>
  <form-beans> 

   As you can see, the array of String will receive
the user selected values and the Collection object
will have all possible values.

   In your jsp, you will have the following code:

    <html:select property="selectedList"
multiple="true" size"5">
        <logic:notEmpty  name="editForm"
property="listColl" scope="request">         
          <html:optionsCollection property="listColl" 
value="value" label="label"/>  
        </logic:notEmpty>
    </html:select> 

   The <logic:notEmpty> tag is only necessary if it is
possible this collection has null values. It tests if
the collection has only not null values.

   <html:optionsCollection> tag looks for a property
named listColl in your form (note: this tag should be
nested inside a <html:form> tag) and iterates between
collection elements. The collection property type can
be an array of objects, a Collection, a Map or an
Enumeration, im my case I used Collection. Each
element of the collection should be a bean object that
have two properties: one named "value" and other named
"label"(or any name you indicate in value and label
attributes of the tag). Struts have a class called
org.apache.struts.util.LabelValueBean that can be used
as the type of the objects of your collection.

   So, your action that is called before your page be
displayed should have a code to populate your
collection. Like this:

   Collection collection = new ArrayList();        
   collection.add(new LabelValueBean("1","Option1"));
   collection.add(new LabelValueBean("2","Option2"));
   collection.add(new LabelValueBean("3","Option3"));
 
   ((DynaActionForm)form).set("listColl",collection);

   If you need to back to the page after a validation
error, don't forget to define the input attribute of
your action in struts-config.xml to the action where
you populate your collection instead of the jsp
directly. Final observation is that when you back to
the page Struts compares the values submitted in the
String[] property and selects in the collection these
itens for you.

   I hope it helps you.
   Caroline Holanda
   IT Consultant 

 --- Brill Pappin <br...@stabilia.com> escreveu: > I
too am finding the docs on the select tag rather
> unspecific.
> and its got to be the most used tag (here at least).
> The key is the <html:options/> tag, but I haven't
> actually got it to work...
> some examples would be nice.
> 
> IMO - the select tag should automatically populate
> itself if it found a
> matching Collection property with a specific
> pattern:
> MyForm{
>     String getSelectValue();
>     Collection getSelectValueOptions();
> }
> 
> <html:select property="selectValue"
> options="selectValueOptions">
>     <html:options value="optionValue"
> label="optionLabel"/>
> </html:select>
> 
> where optionValue and optionLable are properties of
> the collection elements
> from getSelectValueOptions.
> 
> Of course, I think something like this is already
> implemented, using the
> html:options, but like I said, I never got it to
> work.
> 
> - Brill Pappin
> 
> ----- Original Message ----- 
> From: "Graham Leggett" <mi...@sharp.fm>
> To: "Struts Users Mailing List"
> <st...@jakarta.apache.org>
> Sent: Friday, May 23, 2003 7:36 AM
> Subject: Example of <html:select> in use
> 
> 
> > Hi all,
> >
> > Can anyone give me an example JSP of where the
> <html:select> tag is used
> > to render a multiple select box from a provided
> java.util.List? I have
> > trawled the docs, but they are too vague to be
> useful.
> >
> > The docs claim that the "name" property allows the
> select box to be
> > pre-populated with select/deselect information,
> but this is not enough
> > information. How do I specify the property of the
> bean referred to by
> > name, and how do I specify the type of that
> property? And what should
> > the contents of that property be in order for the
> selectbox to be
> > considered selected?
> >
> > Does the <html:select> tag iterate through all the
> options? The docs are
> > not clear on whether I need to do this, or whether
> I need to use an
> > <logic:iterate> tag as well.
> >
> > Any clues?
> >
> > Regards,
> > Graham
> > -- 
> > -----------------------------------------
> > minfrin@sharp.fm "There's a moon
> > over Bourbon Street
> > tonight..."
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> >
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

=====
******************************
Cuide das pessoas que vc ama! 
Elas são presentes de Deus!

_______________________________________________________________________
Yahoo! Mail
O melhor e-mail gratuito da internet: 6MB de espaço, antivírus, acesso POP3, filtro contra spam. 
http://br.mail.yahoo.com/

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


Re: Example of in use

Posted by Brill Pappin <br...@stabilia.com>.
I too am finding the docs on the select tag rather unspecific.
and its got to be the most used tag (here at least).
The key is the <html:options/> tag, but I haven't actually got it to work...
some examples would be nice.

IMO - the select tag should automatically populate itself if it found a
matching Collection property with a specific pattern:
MyForm{
    String getSelectValue();
    Collection getSelectValueOptions();
}

<html:select property="selectValue" options="selectValueOptions">
    <html:options value="optionValue" label="optionLabel"/>
</html:select>

where optionValue and optionLable are properties of the collection elements
from getSelectValueOptions.

Of course, I think something like this is already implemented, using the
html:options, but like I said, I never got it to work.

- Brill Pappin

----- Original Message ----- 
From: "Graham Leggett" <mi...@sharp.fm>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, May 23, 2003 7:36 AM
Subject: Example of <html:select> in use


> Hi all,
>
> Can anyone give me an example JSP of where the <html:select> tag is used
> to render a multiple select box from a provided java.util.List? I have
> trawled the docs, but they are too vague to be useful.
>
> The docs claim that the "name" property allows the select box to be
> pre-populated with select/deselect information, but this is not enough
> information. How do I specify the property of the bean referred to by
> name, and how do I specify the type of that property? And what should
> the contents of that property be in order for the selectbox to be
> considered selected?
>
> Does the <html:select> tag iterate through all the options? The docs are
> not clear on whether I need to do this, or whether I need to use an
> <logic:iterate> tag as well.
>
> Any clues?
>
> Regards,
> Graham
> -- 
> -----------------------------------------
> minfrin@sharp.fm "There's a moon
> over Bourbon Street
> tonight..."
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


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