> Anders has had a good point all along. <ww:property/> is really doing two
> jobs: push and print. We are all OK with it because we're used to it. But

Not just that. property is also used for setting context attributes,
something that isn't mentioned in the docs. This is a deeply intuitive
feature. You can do <ww:property id="foo" value="bar" /> and the value of
"bar" will be pulled off the stack and stuffed into
pageContext.setAttribute("foo", valueOfBar). But it gets better. Since
stack.findValue(null) returns the top of the stack (same as
stack.findValue(".")), <ww:property id="foo" /> puts whatever is on the
top of the stack into the pageContext. Now when I started this email, I
thought I had found 2 or 3 bugs, but after spending some time with testing
and reading through source, I see this is actually a nice feature.
Unfortunatly, none of the docs mention it, so I didn't have a clue.

A sample usage of this would be to expose the VS to a custom taglib (I
think, please correct me if I'm wrong on this):

1: <ww:property value="foo/bar">
2:   <ww:property id="boo" value="far" />
3:   <mytaglib:mytag />
4:   <ww:property id="boo" />
5:   <mytaglib:mytag />
6:   <ww:property value="far" />
7:   <ww:property />
8: </ww:property>

The above:
1) changes the root to "foo/bar"
2) sets an attribute in pageContext called "boo" to the value of
"foo/bar/far" (pulled from the VS)
3) Calls a custom tag that can access the value of "foo/bar/far" via
pageContext
4) sets an attribute in pageContext called "boo" to the value of "foo/bar"
5) Calls a custom tag that can access the value of "foo/bar" via
pageContext
6) prints the value of "foo/bar/far"
7) prints the value of "foo/bar"

One of two things NEEDS to happen here. Either property tag NEEDS to be
broken up, before 1.3. OR one of you people who is set on not breaking it
up needs to document the beegeebers out of it, put your money where your
mouth is so new users at least stand a chance at using this thing.

--Erik

NOTE: Lines 2 and 4 above will also print the values of far and "."
respectively, but this is due to a bug (WW-79). A patch for this will
follow soon.



-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to