4.0: listeners

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

4.0: listeners

Gregg D Bolinger
I have a page with a form binding like so:

<component id="form" type="Form">
   <binding name="delegate" value="beans.delegate"/>
   <binding name="listener" value="listeners.formSubmitted"/>
</component>

My java file has a method:

public void formSubmitted(IRequestCycle cycle) {
   //code for listener in here
}

HTML form declaration:

<form jwcid="form">...</form>

When I click the button on the web page I get the following error:

Object $Login_2@1d1fc02[Login] does not implement a listener method
named 'listeners.formSubmitted'.

This worked in 3.0.3. I read the new docs on listeners and it would
appear that it should work.

Gregg Bolinger

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Geoff Longman
Unless I'm wrong the following are all valid:

<binding name="listener" value="ognl:listeners.formSubmitted"/>

<binding name="listener" value="listener:formSubmitted"/>

<binding name="listener" value="formSubmitted"/>

sorry to stir up the pot here but I think this is a good example of
how default binding types are going to cause more confusion than it's
worth.

Geoff

On 5/10/05, Gregg D Bolinger <[hidden email]> wrote:

> I have a page with a form binding like so:
>
> <component id="form" type="Form">
>    <binding name="delegate" value="beans.delegate"/>
>    <binding name="listener" value="listeners.formSubmitted"/>
> </component>
>
> My java file has a method:
>
> public void formSubmitted(IRequestCycle cycle) {
>    //code for listener in here
> }
>
> HTML form declaration:
>
> <form jwcid="form">...</form>
>
> When I click the button on the web page I get the following error:
>
> Object $Login_2@1d1fc02[Login] does not implement a listener method
> named 'listeners.formSubmitted'.
>
> This worked in 3.0.3. I read the new docs on listeners and it would
> appear that it should work.
>
> Gregg Bolinger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Robert Zeigler
In reply to this post by Gregg D Bolinger
I'll confess to not following many of the 4.0 changes extremely closely,
but...
have you tried:
<binding name="listener" value="formSubmitted"/> ?
I seem to recall the listener change needing only the method name
now...? (Someone correct me if I'm wrong... I'm in a hurry and "shooting
from the hip" on this one)

Robert

Gregg D Bolinger wrote:

> I have a page with a form binding like so:
>
> <component id="form" type="Form">
>    <binding name="delegate" value="beans.delegate"/>
>    <binding name="listener" value="listeners.formSubmitted"/>
> </component>
>
> My java file has a method:
>
> public void formSubmitted(IRequestCycle cycle) {
>    //code for listener in here
> }
>
> HTML form declaration:
>
> <form jwcid="form">...</form>
>
> When I click the button on the web page I get the following error:
>
> Object $Login_2@1d1fc02[Login] does not implement a listener method
> named 'listeners.formSubmitted'.
>
> This worked in 3.0.3. I read the new docs on listeners and it would
> appear that it should work.
>
> Gregg Bolinger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Gregg D Bolinger
Yes, that is corrrect. Using must formSubmitted works. Any of the methods
Geoff stated work.

Gregg

On 5/10/05, Robert Zeigler <[hidden email]> wrote:

>
> I'll confess to not following many of the 4.0 changes extremely closely,
> but...
> have you tried:
> <binding name="listener" value="formSubmitted"/> ?
> I seem to recall the listener change needing only the method name
> now...? (Someone correct me if I'm wrong... I'm in a hurry and "shooting
> from the hip" on this one)
>
> Robert
>
> Gregg D Bolinger wrote:
> > I have a page with a form binding like so:
> >
> > <component id="form" type="Form">
> > <binding name="delegate" value="beans.delegate"/>
> > <binding name="listener" value="listeners.formSubmitted"/>
> > </component>
> >
> > My java file has a method:
> >
> > public void formSubmitted(IRequestCycle cycle) {
> > //code for listener in here
> > }
> >
> > HTML form declaration:
> >
> > <form jwcid="form">...</form>
> >
> > When I click the button on the web page I get the following error:
> >
> > Object $Login_2@1d1fc02[Login] does not implement a listener method
> > named 'listeners.formSubmitted'.
> >
> > This worked in 3.0.3. I read the new docs on listeners and it would
> > appear that it should work.
> >
> > Gregg Bolinger
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Konstantin Ignatyev
Then I would say that compatibility with 3.0 is unnecessary broken. It
is very easy to put something like this inside of T4
if( expression.startsWith( "listeners"){
  expression = expression.substr( 9 );
}

and that will make migration path easier for many.

Gregg D Bolinger wrote:

>Yes, that is corrrect. Using must formSubmitted works. Any of the methods
>Geoff stated work.
>
>Gregg
>
>On 5/10/05, Robert Zeigler <[hidden email]> wrote:
>  
>
>>I'll confess to not following many of the 4.0 changes extremely closely,
>>but...
>>have you tried:
>><binding name="listener" value="formSubmitted"/> ?
>>I seem to recall the listener change needing only the method name
>>now...? (Someone correct me if I'm wrong... I'm in a hurry and "shooting
>>from the hip" on this one)
>>
>>Robert
>>
>>    
>>

--
Thanks,

Konstantin Ignatyev

http://www.kgionline.com





PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000

Bowers, C.A.  The Culture of Denial:  
Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  
New York:  State University of New York Press, 1997: (4) (5) (p.206)


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Gregg D Bolinger
I think that there is a trade off between making things easier for 3.0 app
transition and making things easier for new 4.0 development. It's probably a
catch 22. Just typing the actual listener method name is much shorter and
less likely prone to fat fingering than the 3.0 way.

I'd say it's really not that big of a deal either way and definately not
worth worrying about. ;)

Gregg

On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:

>
> Then I would say that compatibility with 3.0 is unnecessary broken. It
> is very easy to put something like this inside of T4
> if( expression.startsWith( "listeners"){
> expression = expression.substr( 9 );
> }
>
> and that will make migration path easier for many.
>
> Gregg D Bolinger wrote:
>
> >Yes, that is corrrect. Using must formSubmitted works. Any of the methods
> >Geoff stated work.
> >
> >Gregg
> >
> >On 5/10/05, Robert Zeigler <[hidden email]> wrote:
> >
> >
> >>I'll confess to not following many of the 4.0 changes extremely closely,
> >>but...
> >>have you tried:
> >><binding name="listener" value="formSubmitted"/> ?
> >>I seem to recall the listener change needing only the method name
> >>now...? (Someone correct me if I'm wrong... I'm in a hurry and "shooting
> >>from the hip" on this one)
> >>
> >>Robert
> >>
> >>
> >>
>
> --
> Thanks,
>
> Konstantin Ignatyev
>
> http://www.kgionline.com
>
> PS: If this is a typical day on planet earth, humans will add fifteen
> million tons of carbon to the atmosphere, destroy 115 square miles of
> tropical rainforest, create seventy-two miles of desert, eliminate between
> forty to one hundred species, erode seventy-one million tons of topsoil, add
> 2.700 tons of CFCs to the stratosphere, and increase their population by
> 263.000
>
> Bowers, C.A. The Culture of Denial:
> Why the Environmental Movement Needs a Strategy for Reforming Universities
> and Public Schools.
> New York: State University of New York Press, 1997: (4) (5) (p.206)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Geoff Longman
In reply to this post by Konstantin Ignatyev
compatibility with 3.0 is not broken since

ognl:listeners.formSubmitted

still works.

On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:

> Then I would say that compatibility with 3.0 is unnecessary broken. It
> is very easy to put something like this inside of T4
> if( expression.startsWith( "listeners"){
>   expression = expression.substr( 9 );
> }
>
> and that will make migration path easier for many.
>
> Gregg D Bolinger wrote:
>
> >Yes, that is corrrect. Using must formSubmitted works. Any of the methods
> >Geoff stated work.
> >
> >Gregg
> >
> >On 5/10/05, Robert Zeigler <[hidden email] > wrote:
> >
> >
> >>I'll confess to not following many of the 4.0 changes extremely closely,
> >>but...
> >>have you tried:
> >><binding name="listener" value="formSubmitted"/> ?
> >>I seem to recall the listener change needing only the method name
> >>now...? (Someone correct me if I'm wrong... I'm in a hurry and "shooting
> >>from the hip" on this one)
> >>
> >>Robert
> >>
> >>
> >>
>
> --
> Thanks,
>
> Konstantin Ignatyev
>
> http://www.kgionline.com 
>
> PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000
>
> Bowers, C.A.  The Culture of Denial:
> Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.
> New York:  State University of New York Press, 1997: (4) (5) (p.206)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: 4.0: listeners

Patrick Casey
In reply to this post by Gregg D Bolinger

        How about a 3.0 compatibility flag (off by default) that would let
you use old 3.0 DTDs (or at least most of them). That way new users would
start out in the new file structure, but current users would have a crutch
to transition them into the 4.0 world without having to rewrite lots of XML?

        It's not worth worrying about if you're the developer and know
what's going on, but 4 or 5 of these little "not worth worrying about it"
changes can make a user who upgrades from 3.0 to 4.0 pull his hair out and
kick the dog in frustration.

        It's like when Sun decided they were going to change the way
timezone formats were stored between 1.4.2 and 1.4.3 (if memory serves) and
broke a bunch of my code. Sure, it was easy to fix, but first there was the
three hours of disbelief that upgrading my JVM would cause my code to light
up like a Christmas tree, then the hour spend on the change notes to find
what the heck they'd done, then the ten minutes to fix it.

        --- Pat

> -----Original Message-----
> From: Gregg D Bolinger [mailto:[hidden email]]
> Sent: Tuesday, May 10, 2005 9:22 AM
> To: Tapestry users
> Subject: Re: 4.0: listeners
>
> I think that there is a trade off between making things easier for 3.0 app
> transition and making things easier for new 4.0 development. It's probably
> a
> catch 22. Just typing the actual listener method name is much shorter and
> less likely prone to fat fingering than the 3.0 way.
>
> I'd say it's really not that big of a deal either way and definately not
> worth worrying about. ;)
>
> Gregg
<snip>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: 4.0: listeners

Patrick Casey
In reply to this post by Geoff Longman

        Didn't "listeners.formSubmitted" work in 3.0 though?

        So in 3.0:

        <binding name="listener" value="listeners.formSubmitted"/>
        <binding name="listener" value="ognl:listeners.formSubmitted"/>

        Both worked.

        In 4.0:

        <binding name="listener" value="formSubmitted"/>
        <binding name="listener" value="ognl:listeners.formSubmitted"/>

        So unless I'm misunderstanding this change, we deprecated one of two
3.0 formats, and introduced one new one. So if you happened to use the old
format (listneres.formSubmitted) and upgraded to 4.0 it'd stop working,
wouldn't it?

        Or did I miss something in the explanation?

        --- Pat

> -----Original Message-----
> From: Geoff Longman [mailto:[hidden email]]
> Sent: Tuesday, May 10, 2005 9:29 AM
> To: Tapestry users
> Subject: Re: 4.0: listeners
>
> compatibility with 3.0 is not broken since
>
> ognl:listeners.formSubmitted
>
> still works.




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Howard Lewis Ship
In reply to this post by Konstantin Ignatyev
On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:
> Then I would say that compatibility with 3.0 is unnecessary broken. It
> is very easy to put something like this inside of T4

No, backards compatibility  is NOT broken.

The syntax ognl:listeners.method is what a 3.0 app would use, and that
still works.

For 4.0, there's the listener: prefix, so listener:method is equivalent.

Since the listener parameter specifies "listener" as its default
prefix, you can just specify the method name, "method".  Again, all of
the following are equivalent (for the Form's or DirectLink's listener
parameter):

ognl:listeners.myMethod
listener:myMethod
myMethod

I prefer the last version.  The latter two are marginally more
efficient than the OGNL version (though invoking a listener method
does use some amount of reflection).


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Howard Lewis Ship
In reply to this post by Patrick Casey
On 5/10/05, Patrick Casey <[hidden email]> wrote:
>
>         How about a 3.0 compatibility flag (off by default) that would let
> you use old 3.0 DTDs (or at least most of them). That way new users would
> start out in the new file structure, but current users would have a crutch
> to transition them into the 4.0 world without having to rewrite lots of XML?

The 3.0 DTDs *still* work in 4.0.  There's tiny gotchas concerning
<parameter direction="custom"> and <service>. Everything else works
perfectly.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Mind Bridge
In reply to this post by Howard Lewis Ship
One possible way to resolve the issue: if the DTD used is earlier than 4.0,
then use the 'ognl' prefix as a default for 'binding'. Otherwise default to
the one that the component provides.


----- Original Message -----
From: "Howard Lewis Ship" <[hidden email]>
To: "Tapestry users" <[hidden email]>
Sent: Tuesday, May 10, 2005 7:40 PM
Subject: Re: 4.0: listeners


On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:
> Then I would say that compatibility with 3.0 is unnecessary broken. It
> is very easy to put something like this inside of T4

No, backards compatibility  is NOT broken.

The syntax ognl:listeners.method is what a 3.0 app would use, and that
still works.

For 4.0, there's the listener: prefix, so listener:method is equivalent.

Since the listener parameter specifies "listener" as its default
prefix, you can just specify the method name, "method".  Again, all of
the following are equivalent (for the Form's or DirectLink's listener
parameter):

ognl:listeners.myMethod
listener:myMethod
myMethod

I prefer the last version.  The latter two are marginally more
efficient than the OGNL version (though invoking a listener method
does use some amount of reflection).


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Konstantin Ignatyev
In reply to this post by Howard Lewis Ship
I have impression that people reported that syntax:
  <component id="reportCriteriaForm" type="Form">
    <binding name="listener"  expression="listeners.onSubmit"/>
  </component>
does NOT work in T4.

If that is the case then T4 breaks compatibility.

Did I miss something?

Howard Lewis Ship wrote:

>On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:
>  
>
>>Then I would say that compatibility with 3.0 is unnecessary broken. It
>>is very easy to put something like this inside of T4
>>    
>>
>
>No, backards compatibility  is NOT broken.
>
>The syntax ognl:listeners.method is what a 3.0 app would use, and that
>still works.
>
>For 4.0, there's the listener: prefix, so listener:method is equivalent.
>
>Since the listener parameter specifies "listener" as its default
>prefix, you can just specify the method name, "method".  Again, all of
>the following are equivalent (for the Form's or DirectLink's listener
>parameter):
>
>ognl:listeners.myMethod
>listener:myMethod
>myMethod
>
>I prefer the last version.  The latter two are marginally more
>efficient than the OGNL version (though invoking a listener method
>does use some amount of reflection).
>
>
>  
>


--
Thanks,

Konstantin Ignatyev

http://www.kgionline.com





PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000

Bowers, C.A.  The Culture of Denial:  
Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  
New York:  State University of New York Press, 1997: (4) (5) (p.206)


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: 4.0: listeners

richard.hensley
In reply to this post by Gregg D Bolinger
Compatibility is that specifications written using the 3.0 DTD work with the
4.0 code base with the two caveat's mentioned by Howard.

I would expect specifications written to the 4.0 DTD to follow different
rules.

This might not be everybody's definition, but I think it's a good one.

Richard

-----Original Message-----
From: Konstantin Iignatyev [mailto:[hidden email]]
Sent: Tuesday, May 10, 2005 10:39 AM
To: Tapestry users
Subject: Re: 4.0: listeners

I have impression that people reported that syntax:
  <component id="reportCriteriaForm" type="Form">
    <binding name="listener"  expression="listeners.onSubmit"/>
  </component>
does NOT work in T4.

If that is the case then T4 breaks compatibility.

Did I miss something?

Howard Lewis Ship wrote:

>On 5/10/05, Konstantin Iignatyev <[hidden email]> wrote:
>  
>
>>Then I would say that compatibility with 3.0 is unnecessary broken. It
>>is very easy to put something like this inside of T4
>>    
>>
>
>No, backards compatibility  is NOT broken.
>
>The syntax ognl:listeners.method is what a 3.0 app would use, and that
>still works.
>
>For 4.0, there's the listener: prefix, so listener:method is equivalent.
>
>Since the listener parameter specifies "listener" as its default
>prefix, you can just specify the method name, "method".  Again, all of
>the following are equivalent (for the Form's or DirectLink's listener
>parameter):
>
>ognl:listeners.myMethod
>listener:myMethod
>myMethod
>
>I prefer the last version.  The latter two are marginally more
>efficient than the OGNL version (though invoking a listener method
>does use some amount of reflection).
>
>
>  
>


--
Thanks,

Konstantin Ignatyev

http://www.kgionline.com





PS: If this is a typical day on planet earth, humans will add fifteen
million tons of carbon to the atmosphere, destroy 115 square miles of
tropical rainforest, create seventy-two miles of desert, eliminate between
forty to one hundred species, erode seventy-one million tons of topsoil, add
2.700 tons of CFCs to the stratosphere, and increase their population by
263.000

Bowers, C.A.  The Culture of Denial:  
Why the Environmental Movement Needs a Strategy for Reforming Universities
and Public Schools.  
New York:  State University of New York Press, 1997: (4) (5) (p.206)


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: 4.0: listeners

Howard Lewis Ship
In reply to this post by Patrick Casey
In the old DTD, there was <binding name="..." expression="..."/>

If you are updating the DTDs, you'll have to change <binding>,
<static-binding>, <message-binding>, <inherited-binding> to the new,
simple <binding>

You get to use the same prefixing in the XML file that is used in the
HTML.  Consistency!

But if you go to the trouble of changing your XML files and using the
4.0 DTDs, you have to be aware that the <binding> value attribute is
interpreted differently than the 3.0 <binding> expression attribute.

On 5/10/05, Patrick Casey <[hidden email]> wrote:

>
>         Didn't "listeners.formSubmitted" work in 3.0 though?
>
>         So in 3.0:
>
>         <binding name="listener" value="listeners.formSubmitted"/>
>         <binding name="listener" value="ognl:listeners.formSubmitted"/>
>
>         Both worked.
>
>         In 4.0:
>
>         <binding name="listener" value="formSubmitted"/>
>         <binding name="listener" value="ognl:listeners.formSubmitted"/>
>
>         So unless I'm misunderstanding this change, we deprecated one of two
> 3.0 formats, and introduced one new one. So if you happened to use the old
> format (listneres.formSubmitted) and upgraded to 4.0 it'd stop working,
> wouldn't it?
>
>         Or did I miss something in the explanation?
>
>         --- Pat
>
> > -----Original Message-----
> > From: Geoff Longman [mailto:[hidden email]]
> > Sent: Tuesday, May 10, 2005 9:29 AM
> > To: Tapestry users
> > Subject: Re: 4.0: listeners
> >
> > compatibility with 3.0 is not broken since
> >
> > ognl:listeners.formSubmitted
> >
> > still works.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Default binding recap [WAS: 4.0: listeners]

Vjeran Marcinko
Hi all.

I posted about this recently on dev list, but I think I know how to express
myself better now...

Anyway, in 4.0 we now have multiple choices :
1. listener="ognl:listeners.formSubmit"
2. listener="listeners:formSubmit"
3. listener="formSubmit"

First one is 3.0 compatibile, second and third have apeared in 4.0, and
beside being shorter, they also use reflection less, thus are probably a bit
faster.
IMHO, although the shortest, problematic is third one.
Why? Because it is the only one that is not self-descriptive. I requires you
to switch to .jwc file to know what type of value that is. True, nobody
forces me to use that style, but thing is that I won't be looking only at
things developed by myself, but also at other's stuff, and that will force
me to switch files.

And I think that "listener" example isn't a good one, because whenever we
see parameter called "listener", it's a kinda standardized name, and we all
know it's a listener parameter, thus default binding has much more sense for
that than normally.
Let's say you have stumbled upon some .html developed by your co-worker who
loves default bindings, and all you see is:
<span jwcid="@AttributePresenter" attribute="shortVersion" />
<span jwcid="@Shotter" character="simple" value="parent" />

And although you remember these AttributePresenter and Shotter components
because you worked with them 3 weeks ago, you cannot exactly remember now
what types of parameters these attribute/character/value are, and you forced
to look at their .jwc files :-(

Regards,
Vjeran

----- Original Message -----
From: "Howard Lewis Ship" <[hidden email]>
To: "Tapestry users" <[hidden email]>
Sent: Tuesday, May 10, 2005 11:15 PM
Subject: Re: 4.0: listeners


In the old DTD, there was <binding name="..." expression="..."/>

If you are updating the DTDs, you'll have to change <binding>,
<static-binding>, <message-binding>, <inherited-binding> to the new,
simple <binding>

You get to use the same prefixing in the XML file that is used in the
HTML.  Consistency!

But if you go to the trouble of changing your XML files and using the
4.0 DTDs, you have to be aware that the <binding> value attribute is
interpreted differently than the 3.0 <binding> expression attribute.

On 5/10/05, Patrick Casey <[hidden email]> wrote:

>
>         Didn't "listeners.formSubmitted" work in 3.0 though?
>
>         So in 3.0:
>
>         <binding name="listener" value="listeners.formSubmitted"/>
>         <binding name="listener" value="ognl:listeners.formSubmitted"/>
>
>         Both worked.
>
>         In 4.0:
>
>         <binding name="listener" value="formSubmitted"/>
>         <binding name="listener" value="ognl:listeners.formSubmitted"/>
>
>         So unless I'm misunderstanding this change, we deprecated one of
two
> 3.0 formats, and introduced one new one. So if you happened to use the old
> format (listneres.formSubmitted) and upgraded to 4.0 it'd stop working,
> wouldn't it?



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 10.5.2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Default binding recap [WAS: 4.0: listeners]

Patrick Casey

        I don't have quite as much to say on the subject, but I will chime
in to say I'm not a big fan of default binding either. I know what I was
learning tapestry it was very confusing to figure out whether I should be
typing "ognl:foo" or just plain "foo" and whether just plain foo was going
to be parsed or a literal.

        I don't really mind typing an extra five characters if it makes my
code more consistent and readable, so I at least would rather that ognl
always meant ognl, and a literal always be a literal. For me, having these
sorts of context specific behaviors just makes the product harder to learn
and harder to debug later for no real benefit (does skipping 5 characters
while typing *really* make much of a difference in the grand scheme of
things? If so, shouldn't we all use single character variable names
exclusively?)
       
        I guess I did have something to say on the topic after all ...

        --- Pat

> -----Original Message-----
> From: Vjeran Marcinko [mailto:[hidden email]]
> Sent: Tuesday, May 10, 2005 9:21 PM
> To: Tapestry users; Howard Lewis Ship
> Subject: Default binding recap [WAS: 4.0: listeners]
>
> Hi all.
>
> I posted about this recently on dev list, but I think I know how to
> express
> myself better now...
>
> Anyway, in 4.0 we now have multiple choices :
> 1. listener="ognl:listeners.formSubmit"
> 2. listener="listeners:formSubmit"
> 3. listener="formSubmit"
>
> First one is 3.0 compatibile, second and third have apeared in 4.0, and
> beside being shorter, they also use reflection less, thus are probably a
> bit
> faster.
> IMHO, although the shortest, problematic is third one.
> Why? Because it is the only one that is not self-descriptive. I requires
> you
> to switch to .jwc file to know what type of value that is. True, nobody
> forces me to use that style, but thing is that I won't be looking only at
> things developed by myself, but also at other's stuff, and that will force
> me to switch files.
>
> And I think that "listener" example isn't a good one, because whenever we
> see parameter called "listener", it's a kinda standardized name, and we
> all
> know it's a listener parameter, thus default binding has much more sense
> for
> that than normally.
> Let's say you have stumbled upon some .html developed by your co-worker
> who
> loves default bindings, and all you see is:
> <span jwcid="@AttributePresenter" attribute="shortVersion" />
> <span jwcid="@Shotter" character="simple" value="parent" />
>
> And although you remember these AttributePresenter and Shotter components
> because you worked with them 3 weeks ago, you cannot exactly remember now
> what types of parameters these attribute/character/value are, and you
> forced
> to look at their .jwc files :-(
>
> Regards,
> Vjeran
>
<snip>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Default binding recap [WAS: 4.0: listeners]

Howard Lewis Ship
I see this as like the split between implicit and declared components.
 Implicit components open up the possiblity of a lot of absuses and
people were initially worried. Once they started building apps with
implicit components, they set individual standards and practices for
when to use implicit vs. when to use declared.

The practice for default bindings will be the same.

Basically, there has to be a compelling reason *not* to use ognl as
the default binding. In fact, there has to be a compelling reason to
specify a default binding.

In only a few cases, the default binding should not be ognl (or
unspecified).  Listener parameters, validator parameters, asset
parameters. I think those will tend to be obvious and your nightmare
scenario won't happen.

On 5/11/05, Patrick Casey <[hidden email]> wrote:

>
>         I don't have quite as much to say on the subject, but I will chime
> in to say I'm not a big fan of default binding either. I know what I was
> learning tapestry it was very confusing to figure out whether I should be
> typing "ognl:foo" or just plain "foo" and whether just plain foo was going
> to be parsed or a literal.
>
>         I don't really mind typing an extra five characters if it makes my
> code more consistent and readable, so I at least would rather that ognl
> always meant ognl, and a literal always be a literal. For me, having these
> sorts of context specific behaviors just makes the product harder to learn
> and harder to debug later for no real benefit (does skipping 5 characters
> while typing *really* make much of a difference in the grand scheme of
> things? If so, shouldn't we all use single character variable names
> exclusively?)
>
>         I guess I did have something to say on the topic after all ...
>
>         --- Pat
>
> > -----Original Message-----
> > From: Vjeran Marcinko [mailto:[hidden email]]
> > Sent: Tuesday, May 10, 2005 9:21 PM
> > To: Tapestry users; Howard Lewis Ship
> > Subject: Default binding recap [WAS: 4.0: listeners]
> >
> > Hi all.
> >
> > I posted about this recently on dev list, but I think I know how to
> > express
> > myself better now...
> >
> > Anyway, in 4.0 we now have multiple choices :
> > 1. listener="ognl:listeners.formSubmit"
> > 2. listener="listeners:formSubmit"
> > 3. listener="formSubmit"
> >
> > First one is 3.0 compatibile, second and third have apeared in 4.0, and
> > beside being shorter, they also use reflection less, thus are probably a
> > bit
> > faster.
> > IMHO, although the shortest, problematic is third one.
> > Why? Because it is the only one that is not self-descriptive. I requires
> > you
> > to switch to .jwc file to know what type of value that is. True, nobody
> > forces me to use that style, but thing is that I won't be looking only at
> > things developed by myself, but also at other's stuff, and that will force
> > me to switch files.
> >
> > And I think that "listener" example isn't a good one, because whenever we
> > see parameter called "listener", it's a kinda standardized name, and we
> > all
> > know it's a listener parameter, thus default binding has much more sense
> > for
> > that than normally.
> > Let's say you have stumbled upon some .html developed by your co-worker
> > who
> > loves default bindings, and all you see is:
> > <span jwcid="@AttributePresenter" attribute="shortVersion" />
> > <span jwcid="@Shotter" character="simple" value="parent" />
> >
> > And although you remember these AttributePresenter and Shotter components
> > because you worked with them 3 weeks ago, you cannot exactly remember now
> > what types of parameters these attribute/character/value are, and you
> > forced
> > to look at their .jwc files :-(
> >
> > Regards,
> > Vjeran
> >
> <snip>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Message, format and single quotes

Oscar Picasso
Hi

I have a problem with formatting text and single quotes.

Lets's say I have the following property file:

username = nom d'utilisateur
required = Le champ {0} est requis

In my validator bean specification I have:
<set-property name="requiredMessage"
              expression="format('required', getMessage('username'))"/>

In the html file:
<label for="username"><span jwcid="@FieldLabel"
field="ognl:components.username"/></label>
<input jwcid="username@ValidField" displayName="message:username"
       validator="ognl:beans.usernameValidator" value="ognl:user.username"/>

The error message is then:
Le champ nom dutilisateur est requis
[single quote removed]

and the label:
nom d'utilisateur
[correct]

Any idea ?

I have tried to add a single quote:
username = nom d''utilisateur

I then get:

error message -> Le champ nom d'utilisateur est requis
label -> nom d''utilisateur


Thanks


Oscar


       
               
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Default binding recap [WAS: 4.0: listeners]

Johan Maasing
In reply to this post by Vjeran Marcinko
>Howard M. Lewis Ship wrote:
>I see this as like the split between implicit and declared components.
> Implicit components open up the possiblity of a lot of absuses and
>people were initially worried. Once they started building apps with
>implicit components, they set individual standards and practices for
>when to use implicit vs. when to use declared.

Code practices and conventions are a good thing and in many cases it is preferrable to have a flexible framework and invent your own restrictions rather than having the framework force it on everybody. That said, as a newbie at Tapestry, although not at Java or web, and I must agree with Patrick and Vjeran, it sure makes it harder to grasp the great design and ideas behind tapestry when you get stuck on syntax that looks different from example to example.
For example, the component documentation is very nice, but the examples use implicit components sometimes and explicit sometimes. I found that very confusing at first. Sure, when you get the hang of it the examples makes perfect sense but at first it does not help the already steep (un)learning curve.
Perhaps all of us newbies could collaborate on the Tapstry Wiki and create a kind of style guide to writing tapestry examples and documentation. Things that we as newbies get stuck on. For example: Try to use explicit components if it otherwise makes no difference, try to use the listener:-prefix and so on.


>On 5/11/05, Patrick Casey <[hidden email]> wrote:
>> in to say I'm not a big fan of default binding either. I know what I was
>> learning tapestry it was very confusing to figure out whether I should be
>> typing "ognl:foo" or just plain "foo" and whether just plain foo was going
>> to be parsed or a literal.
...
>>
>>         --- Pat



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12