You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mind Bridge <mi...@yahoo.com> on 2005/03/25 17:41:44 UTC

XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Hi all,

I have put the XTile component on T-Deli (www.t-deli.com).

This component allows a simple JavaScript function call to invoke a listener
on the server and pass data to it using the now popular XMLHttpRequest
mechanism. The listener can also return data, and another Javascript
function will be invoked when it is received.

In short, this makes using XMLHttpRequest as simple as using a DirectLink.

Here is a quick example of this functionality:
http://www.t-deli.com/ex1/app?service=page/XTileTest

Basically, it is a name completion along the lines of Google Suggest. When
you start typing the name of a country, the web page will ask the server for
possible completions. The completions will be then displayed underneath.

Implementing this functionality is simple. First declare the XTile component
in your page:

    <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
        sendName="sendValue" receiveName="recvCompletions"/>

The above means that when the JavaScript function sendValue() is called, the
handleCallback listener will be invoked, and that when it finishes, the
recvCompletions() function on the client must be called.

The text field is then modified to call sendValue() when a modification
occurs:

 <input onkeyup="sendValue(this.value)" .../>

The handleCallback() listener is implemented in the Java code to generate
the completions:

public void handleCallback(IRequestCycle cycle)
 {
    Object[] params = cycle.getServiceParameters();
    if (params.length == 0) return;

    String typed = params[0].toString();
    String[] ret = findCompletions(typed);
    cycle.setServiceParameters(ret);
 }

Finally, back in the HTML define the function recvCompletions() to handle
the returned completions:

function recvCompletions(arr) {
    document.f.comps.value = arr.join("\n");
}

That's all. The component produces the other necessary Javascript and
registers the needed Tapestry service to handle the rest.


Note that while this code has been in circulation for a while, it has been
repackaged and refurbished, so it might cause some problems. It has not been
tested with a very wide variety of browsers, although it does work with
Firefox and IE. Any help there is appreciated :)

Finally, a lot of other dynamic components can be very easily produced using
XTile, such as a proper  completion text field (not just a quick demo), a
spelling checker, etc. A lot of ideas were described in earlier messages in
this list. If anyone wants work on that, please let me know -- I would be
happy to lend a hand.


Best regards,
-mb


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


Re: form validation

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 27, 2005, at 3:31 PM, Ben Eng wrote:
> On Sat, Mar 26, 2005 at 08:49:30PM -0500, Erik Hatcher wrote:
>>
>> On Mar 26, 2005, at 1:06 PM, Ben Eng wrote:
>>
>>> On Sat, Mar 26, 2005 at 08:03:42AM -0500, Erik Hatcher wrote:
>>>> Do you have specific patches/suggestions for the improvement of
>>>> validation?
>>>
>>> How about having the form component enforce refresh-resubmit
>>> prevention as an option?
>>
>> Could you elaborate on specifically what you desire here?
>>
>> What I've done in the past to prevent forms from being submitted
>> successively (double-clicking the submit button is the prime culprit)
>> is to disable the submit button with JavaScript after the first click.
>
> This is related to your other thread of discussion. Hitting the
> browser refresh button or using the browser back button can resubmit
> the form. If the Flow Synchronizer Token pattern is the best way to
> detect and prevent the resubmit, I think it would be nice for the Form
> component to implement this.

My approach is to redirect after a form submit that I don't want to be 
resubmittable.  The token trick would be good for situations where a 
user might hit the back button and press submit again, though this 
isn't of much concern for my applications.

Adding the form token check into Tapestry makes sense to me.  Has 
someone implemented this and willing to donate their code?

	Erik


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


Programmatic validation - How to have same behavior as Tapestry?

Posted by david joffrin <da...@hotmail.com>.
Hi,

If I have Label and an Entry field linked together, Tapestry will 
automatically turn the label in RED if there is an error on that entry 
field.
How can I implement the same behavior for programmatic exception; I mean by 
that in my application code.

Thanks.
DvJ



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


Re: form validation

Posted by Ben Eng <be...@jetpen.com>.
On Sat, Mar 26, 2005 at 08:49:30PM -0500, Erik Hatcher wrote:
> 
> On Mar 26, 2005, at 1:06 PM, Ben Eng wrote:
> 
> >On Sat, Mar 26, 2005 at 08:03:42AM -0500, Erik Hatcher wrote:
> >>Do you have specific patches/suggestions for the improvement of
> >>validation?
> >
> >How about having the form component enforce refresh-resubmit
> >prevention as an option?
> 
> Could you elaborate on specifically what you desire here?
> 
> What I've done in the past to prevent forms from being submitted 
> successively (double-clicking the submit button is the prime culprit) 
> is to disable the submit button with JavaScript after the first click.

This is related to your other thread of discussion. Hitting the
browser refresh button or using the browser back button can resubmit
the form. If the Flow Synchronizer Token pattern is the best way to
detect and prevent the resubmit, I think it would be nice for the Form
component to implement this.

Ben

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


Re: form validation

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 26, 2005, at 1:06 PM, Ben Eng wrote:

> On Sat, Mar 26, 2005 at 08:03:42AM -0500, Erik Hatcher wrote:
>> Do you have specific patches/suggestions for the improvement of
>> validation?
>
> How about having the form component enforce refresh-resubmit
> prevention as an option?

Could you elaborate on specifically what you desire here?

What I've done in the past to prevent forms from being submitted 
successively (double-clicking the submit button is the prime culprit) 
is to disable the submit button with JavaScript after the first click.

	Erik


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


Re: form validation

Posted by Ben Eng <be...@jetpen.com>.
On Sat, Mar 26, 2005 at 08:03:42AM -0500, Erik Hatcher wrote:
> Do you have specific patches/suggestions for the improvement of 
> validation?

How about having the form component enforce refresh-resubmit
prevention as an option?

Ben

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Vjeran Marcinko <vj...@tis.hr>.
----- Original Message ----- 
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Saturday, March 26, 2005 2:03 PM
Subject: Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry


> I agree with your sentiment.  There is much work to be done in many
> areas.  As Howard often tries to do, we need to involve the community
> more in the depths of Tapestry to make the changes that are needed.
> The ValidField situation irks me too.  Often though, its easier for me
> to build my own components that do what I want rather than tweak the
> core and risk breaking something or making changes that others do not
> agree with - that is my dilemma in improving the core of Tapestry.  Not
> to mention that its a real bear to build/test Tapestry currently and
> that raises the barrier to entry IMO.
>
> Do you have specific patches/suggestions for the improvement of
> validation?  We're all ears!

Unfortunately nothing from me.
Lot of times I wonder am I being smart ass here, since I criticize some
things, but neither have time nor skill (actually I developed only 2
Tapestry apps) to improve something, but I follow dev and user lists
constantly, and it seems to me that Tapestry definetly needs to define
priorities of it's TODO items, especially since developing resources are so
scarce. That was basically my comment above, since need for Ajax seems
miserable compared to some other needs. At least by me. Maybe it's marketing
stuff which I know nothing about.
Though, speaking about this very subject, didn't Paul Ferraro mention some
weeks ago that he is in the middle of developing validation improvements for
3.1 (maybe I'm wrong)? Actually, sometimes I even prefer to do form
validation inside web controller (Tapestry pages) myself, because I have a
feel that I'm tying my web app less to specific framework then...

-Vjeran



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


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 26, 2005, at 7:37 AM, Vjeran Marcinko wrote:
> ----- Original Message -----
> From: "Erik Hatcher" <er...@ehatchersolutions.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Saturday, March 26, 2005 11:03 AM
> Subject: Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry
>
>
>> Nicely done!
>>
>> It's especially great that there is now a simple example that shows 
>> how
>> cleanly Tapestry can fit into the Ajax hype.
>
> Call me anti-hype guy, but it seems to me that recently more people are
> posting on this list wishing Ajax support than for something required 
> 1000x
> more by tipical web apps out there, such as consistent form validation
> (currently ValidField is only for text field) ?

I agree with your sentiment.  There is much work to be done in many 
areas.  As Howard often tries to do, we need to involve the community 
more in the depths of Tapestry to make the changes that are needed.  
The ValidField situation irks me too.  Often though, its easier for me 
to build my own components that do what I want rather than tweak the 
core and risk breaking something or making changes that others do not 
agree with - that is my dilemma in improving the core of Tapestry.  Not 
to mention that its a real bear to build/test Tapestry currently and 
that raises the barrier to entry IMO.

Do you have specific patches/suggestions for the improvement of 
validation?  We're all ears!

	Erik


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Vjeran Marcinko <vj...@tis.hr>.
----- Original Message ----- 
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Saturday, March 26, 2005 11:03 AM
Subject: Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry


> Nicely done!
>
> It's especially great that there is now a simple example that shows how
> cleanly Tapestry can fit into the Ajax hype.

Call me anti-hype guy, but it seems to me that recently more people are
posting on this list wishing Ajax support than for something required 1000x
more by tipical web apps out there, such as consistent form validation
(currently ValidField is only for text field) ?
It's not that I don't find this useful. Nice work MB.

-Vjeran



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


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Nicely done!

It's especially great that there is now a simple example that shows how 
cleanly Tapestry can fit into the Ajax hype.

	Erik


On Mar 25, 2005, at 11:41 AM, Mind Bridge wrote:

> Hi all,
>
> I have put the XTile component on T-Deli (www.t-deli.com).
>
> This component allows a simple JavaScript function call to invoke a 
> listener
> on the server and pass data to it using the now popular XMLHttpRequest
> mechanism. The listener can also return data, and another Javascript
> function will be invoked when it is received.
>
> In short, this makes using XMLHttpRequest as simple as using a 
> DirectLink.
>
> Here is a quick example of this functionality:
> http://www.t-deli.com/ex1/app?service=page/XTileTest
>
> Basically, it is a name completion along the lines of Google Suggest. 
> When
> you start typing the name of a country, the web page will ask the 
> server for
> possible completions. The completions will be then displayed 
> underneath.
>
> Implementing this functionality is simple. First declare the XTile 
> component
> in your page:
>
>     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>         sendName="sendValue" receiveName="recvCompletions"/>
>
> The above means that when the JavaScript function sendValue() is 
> called, the
> handleCallback listener will be invoked, and that when it finishes, the
> recvCompletions() function on the client must be called.
>
> The text field is then modified to call sendValue() when a modification
> occurs:
>
>  <input onkeyup="sendValue(this.value)" .../>
>
> The handleCallback() listener is implemented in the Java code to 
> generate
> the completions:
>
> public void handleCallback(IRequestCycle cycle)
>  {
>     Object[] params = cycle.getServiceParameters();
>     if (params.length == 0) return;
>
>     String typed = params[0].toString();
>     String[] ret = findCompletions(typed);
>     cycle.setServiceParameters(ret);
>  }
>
> Finally, back in the HTML define the function recvCompletions() to 
> handle
> the returned completions:
>
> function recvCompletions(arr) {
>     document.f.comps.value = arr.join("\n");
> }
>
> That's all. The component produces the other necessary Javascript and
> registers the needed Tapestry service to handle the rest.
>
>
> Note that while this code has been in circulation for a while, it has 
> been
> repackaged and refurbished, so it might cause some problems. It has 
> not been
> tested with a very wide variety of browsers, although it does work with
> Firefox and IE. Any help there is appreciated :)
>
> Finally, a lot of other dynamic components can be very easily produced 
> using
> XTile, such as a proper  completion text field (not just a quick 
> demo), a
> spelling checker, etc. A lot of ideas were described in earlier 
> messages in
> this list. If anyone wants work on that, please let me know -- I would 
> be
> happy to lend a hand.
>
>
> Best regards,
> -mb
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Jamie Orchard-Hays <ja...@dang.com>.
MB, that rocks.

Jamie



----- Original Message ----- 
From: "Mind Bridge" <mi...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, March 25, 2005 11:41 AM
Subject: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry


> Hi all,
>
> I have put the XTile component on T-Deli (www.t-deli.com).
>
> This component allows a simple JavaScript function call to invoke a 
> listener
> on the server and pass data to it using the now popular XMLHttpRequest
> mechanism. The listener can also return data, and another Javascript
> function will be invoked when it is received.
>
> In short, this makes using XMLHttpRequest as simple as using a DirectLink.
>
> Here is a quick example of this functionality:
> http://www.t-deli.com/ex1/app?service=page/XTileTest
>
> Basically, it is a name completion along the lines of Google Suggest. When
> you start typing the name of a country, the web page will ask the server 
> for
> possible completions. The completions will be then displayed underneath.
>
> Implementing this functionality is simple. First declare the XTile 
> component
> in your page:
>
>    <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>        sendName="sendValue" receiveName="recvCompletions"/>
>
> The above means that when the JavaScript function sendValue() is called, 
> the
> handleCallback listener will be invoked, and that when it finishes, the
> recvCompletions() function on the client must be called.
>
> The text field is then modified to call sendValue() when a modification
> occurs:
>
> <input onkeyup="sendValue(this.value)" .../>
>
> The handleCallback() listener is implemented in the Java code to generate
> the completions:
>
> public void handleCallback(IRequestCycle cycle)
> {
>    Object[] params = cycle.getServiceParameters();
>    if (params.length == 0) return;
>
>    String typed = params[0].toString();
>    String[] ret = findCompletions(typed);
>    cycle.setServiceParameters(ret);
> }
>
> Finally, back in the HTML define the function recvCompletions() to handle
> the returned completions:
>
> function recvCompletions(arr) {
>    document.f.comps.value = arr.join("\n");
> }
>
> That's all. The component produces the other necessary Javascript and
> registers the needed Tapestry service to handle the rest.
>
>
> Note that while this code has been in circulation for a while, it has been
> repackaged and refurbished, so it might cause some problems. It has not 
> been
> tested with a very wide variety of browsers, although it does work with
> Firefox and IE. Any help there is appreciated :)
>
> Finally, a lot of other dynamic components can be very easily produced 
> using
> XTile, such as a proper  completion text field (not just a quick demo), a
> spelling checker, etc. A lot of ideas were described in earlier messages 
> in
> this list. If anyone wants work on that, please let me know -- I would be
> happy to lend a hand.
>
>
> Best regards,
> -mb
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by "Brian K. Wallace" <br...@transmorphix.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Very nice to see an example like this up. Great job!

Mind Bridge wrote:
| Hi all,
|
| I have put the XTile component on T-Deli (www.t-deli.com).
|
| This component allows a simple JavaScript function call to invoke a
listener
| on the server and pass data to it using the now popular XMLHttpRequest
| mechanism. The listener can also return data, and another Javascript
| function will be invoked when it is received.
|
| In short, this makes using XMLHttpRequest as simple as using a DirectLink.
|
| Here is a quick example of this functionality:
| http://www.t-deli.com/ex1/app?service=page/XTileTest
|
| Basically, it is a name completion along the lines of Google Suggest. When
| you start typing the name of a country, the web page will ask the
server for
| possible completions. The completions will be then displayed underneath.
|
| Implementing this functionality is simple. First declare the XTile
component
| in your page:
|
|     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
|         sendName="sendValue" receiveName="recvCompletions"/>
|
| The above means that when the JavaScript function sendValue() is
called, the
| handleCallback listener will be invoked, and that when it finishes, the
| recvCompletions() function on the client must be called.
|
| The text field is then modified to call sendValue() when a modification
| occurs:
|
|  <input onkeyup="sendValue(this.value)" .../>
|
| The handleCallback() listener is implemented in the Java code to generate
| the completions:
|
| public void handleCallback(IRequestCycle cycle)
|  {
|     Object[] params = cycle.getServiceParameters();
|     if (params.length == 0) return;
|
|     String typed = params[0].toString();
|     String[] ret = findCompletions(typed);
|     cycle.setServiceParameters(ret);
|  }
|
| Finally, back in the HTML define the function recvCompletions() to handle
| the returned completions:
|
| function recvCompletions(arr) {
|     document.f.comps.value = arr.join("\n");
| }
|
| That's all. The component produces the other necessary Javascript and
| registers the needed Tapestry service to handle the rest.
|
|
| Note that while this code has been in circulation for a while, it has been
| repackaged and refurbished, so it might cause some problems. It has
not been
| tested with a very wide variety of browsers, although it does work with
| Firefox and IE. Any help there is appreciated :)
|
| Finally, a lot of other dynamic components can be very easily produced
using
| XTile, such as a proper  completion text field (not just a quick demo), a
| spelling checker, etc. A lot of ideas were described in earlier
messages in
| this list. If anyone wants work on that, please let me know -- I would be
| happy to lend a hand.
|
|
| Best regards,
| -mb
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFCRLyXaCoPKRow/gARAv3dAJ0Y22nxAgusH1d0oi/uGJNMlSU6GgCg2sUG
RrAaMJrIZXXBYvF+lwkjl3g=
=oD0n
-----END PGP SIGNATURE-----

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Andreas Andreou <an...@di.uoa.gr>.
I'm also working on one myself.
The javascript behaviour is shaping up great and I've written it from 
scratch.
However, I'm looking at general ways for
serializing in java and deserializing in javascript.
I really like this exact part of DWR and i'm considering integrating it 
with Tapestry (and especially page listeners)


gvp wrote:

>Hello All,
>
>Has anybody tried to implement Google Suggest like component using
>XTile? BTW I've found GS Dissected by C.Justus
>http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html.
>
>
>
>  
>

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Didier LAFFORGUE <di...@capgemini.com>.
I've developped a "google suggest like" component for tapestry:
http://equalitylearning.org/Tassel/app?service=direct/1/Browse/viewComponent&sp=SdinedineLiveTextField

Unfortunately, there is no documentation even if I think that the component is easy to use. One day, I'll do a web page to explain the behaviour and the use (why days last only 24h00 ???).

  Did

----- Original Message -----
From: "gvp" <bl...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, March 30, 2005 2:31 PM
Subject: Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry


> Hello All,
>
> Has anybody tried to implement Google Suggest like component using
> XTile? BTW I've found GS Dissected by C.Justus
> http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html.
>
>
>
> --
> Best regards,
> gvp                           
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry [ndc] [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
gvp, Yes, I just finished a find people page that uses XTile. The XTile 
basics took me less than half an hour to get working. The hard part was 
making sure I could modify a <select> tag and have the options seen back 
inside my page.java.
Summary: XTile is easy. MultiplePropertySelection is hard to get working.

Points to note:
1. I wrote a tiny amount of JavaScript to add my options into the select 
box:
        function recvCompletions(arr) {
                var comps = document.getElementById('comps');
                comps.options.length = arr.length;
                for (var i = 0; i < arr.length; i++) {
                        comps.options[i] = new Option(arr[i], i, false, 
true);
                }
        }

Its easier to use document.getElementById to find the select box, than 
using the DOM model. The reason is that I don't want to rely on how 
Tapestry renders my code. Also, and more importantly, I don't care what's 
in my border component.

2. Multi-selection is messy to implement. I used the following:
        <select id="comps" jwcid="@Select" multiple="ognl:true" size="10">
                <span jwcid="@Foreach" source="ognl:foundPeople" value=
"ognl:person">
                        <option jwcid="@Option" selected=
"ognl:selectedPerson" label="ognl:person.commonName"/>
                </span>
        </select>
And then I had to some rotten code to implement isSelectedPerson() and 
setSelectedPerson(boolean).
Also, the foundPeople collection must be persistent. This is updated by 
the XTile server listener. This allows the rewinding to work, and I get 
the correctly selected items.

3. I tried contrib:MultiplePropertySelection, but the default rendering is 
a table with 2 columns of checkboxes and labels for the options. I wanted 
a select with options instead. So, I wrote my own renderer, but the 
component wouldn't allow informal parameters. I created my own component 
using the MultiplePropertySelection java class and marked it as allowing 
informal params.

Next Problem: The renderer class could access the component, but the 
renderInformalParameters() method is protected. Eventually, I copied the 
AbstractComponent(?).renderInformalParameters into my renderer class. But 
even reserving parameters, I can't stop it rendering all those component 
specific properties (model, renderer, selectedList).

4. I finally gave up on MultiplePropertySelection when I was not getting 
any selected values back from it. I have no idea why. Maybe the rendering 
interface is not sufficient for my non table implementation.

This all leads me to think that MultiplePropertySelection needs a 
redesign. I guess it should be like PropertySelection component, except it 
should have a selectedValues param instead of value.

Anyway, as far as XTile goes, it's great! Thanks MindBridge.
Ciao,
Jonathan O'Connor
XCOM Dublin



gvp <bl...@gmail.com> 
30/03/2005 13:31
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
"Tapestry users" <ta...@jakarta.apache.org>
cc

Subject
Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry [auf Viren 
geprueft]






Hello All,

Has anybody tried to implement Google Suggest like component using
XTile? BTW I've found GS Dissected by C.Justus
http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html.



-- 
Best regards,
gvp 


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




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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by gvp <bl...@gmail.com>.
Hello All,

Has anybody tried to implement Google Suggest like component using
XTile? BTW I've found GS Dissected by C.Justus
http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html.



-- 
Best regards,
gvp                            


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


Re: hbm2java ???

Posted by Basile Chandesris <ba...@free.fr>.
sarah.simbad@women-at-work.org wrote:
> Does anyone happen to know which .jar file contains the task hbm2java and
> were I get it? Is there also another way to generate java files from hbm
> files?
> 
> Cheers!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

  hibernate-tools.jar

(1) You must have asked the hibernate.org support site for this (forum 
or mailing list).
(2) Gloogling hbm2java gives automagically the solution ;-)


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


hbm2java ???

Posted by sa...@women-at-work.org.
Does anyone happen to know which .jar file contains the task hbm2java and
were I get it? Is there also another way to generate java files from hbm
files?

Cheers!

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by cesar saenz <ja...@gmail.com>.
Wonderful, can't wait to use it.

Thanks
Cesar 


On Fri, 25 Mar 2005 11:49:31 -0500, Howard Lewis Ship <hl...@gmail.com> wrote:
> Interesting approach, using the service parameters as a way to
> communicate back to the client.
> 
> My thoughts on this were more structured; the page/component would
> implement an interface (somewhat like IExternalPage) and the method
> invoked would return a simple string.  I expect a whole famility of
> different services that expect the result to be strings, or XML/HTML,
> or whatever else.
> 
> Anyway, people are clammoring for this stuff; I wish I had the spare
> cycles to deal with this immediately.  Great job as usual!
> 
> 
> On Fri, 25 Mar 2005 18:41:44 +0200, Mind Bridge <mi...@yahoo.com> wrote:
> > Hi all,
> >
> > I have put the XTile component on T-Deli (www.t-deli.com).
> >
> > This component allows a simple JavaScript function call to invoke a listener
> > on the server and pass data to it using the now popular XMLHttpRequest
> > mechanism. The listener can also return data, and another Javascript
> > function will be invoked when it is received.
> >
> > In short, this makes using XMLHttpRequest as simple as using a DirectLink.
> >
> > Here is a quick example of this functionality:
> > http://www.t-deli.com/ex1/app?service=page/XTileTest
> >
> > Basically, it is a name completion along the lines of Google Suggest. When
> > you start typing the name of a country, the web page will ask the server for
> > possible completions. The completions will be then displayed underneath.
> >
> > Implementing this functionality is simple. First declare the XTile component
> > in your page:
> >
> >     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
> >         sendName="sendValue" receiveName="recvCompletions"/>
> >
> > The above means that when the JavaScript function sendValue() is called, the
> > handleCallback listener will be invoked, and that when it finishes, the
> > recvCompletions() function on the client must be called.
> >
> > The text field is then modified to call sendValue() when a modification
> > occurs:
> >
> >  <input onkeyup="sendValue(this.value)" .../>
> >
> > The handleCallback() listener is implemented in the Java code to generate
> > the completions:
> >
> > public void handleCallback(IRequestCycle cycle)
> >  {
> >     Object[] params = cycle.getServiceParameters();
> >     if (params.length == 0) return;
> >
> >     String typed = params[0].toString();
> >     String[] ret = findCompletions(typed);
> >     cycle.setServiceParameters(ret);
> >  }
> >
> > Finally, back in the HTML define the function recvCompletions() to handle
> > the returned completions:
> >
> > function recvCompletions(arr) {
> >     document.f.comps.value = arr.join("\n");
> > }
> >
> > That's all. The component produces the other necessary Javascript and
> > registers the needed Tapestry service to handle the rest.
> >
> > Note that while this code has been in circulation for a while, it has been
> > repackaged and refurbished, so it might cause some problems. It has not been
> > tested with a very wide variety of browsers, although it does work with
> > Firefox and IE. Any help there is appreciated :)
> >
> > Finally, a lot of other dynamic components can be very easily produced using
> > XTile, such as a proper  completion text field (not just a quick demo), a
> > spelling checker, etc. A lot of ideas were described in earlier messages in
> > this list. If anyone wants work on that, please let me know -- I would be
> > happy to lend a hand.
> >
> > Best regards,
> > -mb
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> --
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Michael Henderson <mh...@mac.com>.
Hi,

I have updated the t-deli library information in the palette plugin so 
you can download and start using the XTile component
via drag and drop:

http://tapestrypalette.mjhenderson.com/C868201159/E1627123910/index.html

I think the simplicity of the XTile solution is yet another validation 
of the Tapestry component model.

Mike


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Mind Bridge <mi...@yahoo.com>.
Hi Howard,

I think that using a function that returns an array of strings or something
else would be ideal. It was my oginal idea too.

I chose the current approach for two reasons:
- there may be many such scripts needed in a given page/component. This
makes the possibility of a single entry point that would result from
inheritance a bit problematic.
- even so, it was possible to cobble something up with OGNL and Java inner
classes to provide interfaces with such function, but I think that approach
makes things more complex than many people would like to swallow.

I feel that the 'listeners' in 3.0 are good enough for that goal as they
allows quick results without much headache. Since my target was a component
for vanilla Tapestry 3.0, anything else was suboptimal.

In Tapestry 3.1 the story is different, however. We can do things right in
there.


----- Original Message ----- 
From: "Howard Lewis Ship" <hl...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, March 25, 2005 6:49 PM
Subject: Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry


> Interesting approach, using the service parameters as a way to
> communicate back to the client.
>
> My thoughts on this were more structured; the page/component would
> implement an interface (somewhat like IExternalPage) and the method
> invoked would return a simple string.  I expect a whole famility of
> different services that expect the result to be strings, or XML/HTML,
> or whatever else.
>
> Anyway, people are clammoring for this stuff; I wish I had the spare
> cycles to deal with this immediately.  Great job as usual!
>
>
> On Fri, 25 Mar 2005 18:41:44 +0200, Mind Bridge <mi...@yahoo.com>
wrote:
> > Hi all,
> >
> > I have put the XTile component on T-Deli (www.t-deli.com).
> >
> > This component allows a simple JavaScript function call to invoke a
listener
> > on the server and pass data to it using the now popular XMLHttpRequest
> > mechanism. The listener can also return data, and another Javascript
> > function will be invoked when it is received.
> >
> > In short, this makes using XMLHttpRequest as simple as using a
DirectLink.
> >
> > Here is a quick example of this functionality:
> > http://www.t-deli.com/ex1/app?service=page/XTileTest
> >
> > Basically, it is a name completion along the lines of Google Suggest.
When
> > you start typing the name of a country, the web page will ask the server
for
> > possible completions. The completions will be then displayed underneath.
> >
> > Implementing this functionality is simple. First declare the XTile
component
> > in your page:
> >
> >     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
> >         sendName="sendValue" receiveName="recvCompletions"/>
> >
> > The above means that when the JavaScript function sendValue() is called,
the
> > handleCallback listener will be invoked, and that when it finishes, the
> > recvCompletions() function on the client must be called.
> >
> > The text field is then modified to call sendValue() when a modification
> > occurs:
> >
> >  <input onkeyup="sendValue(this.value)" .../>
> >
> > The handleCallback() listener is implemented in the Java code to
generate
> > the completions:
> >
> > public void handleCallback(IRequestCycle cycle)
> >  {
> >     Object[] params = cycle.getServiceParameters();
> >     if (params.length == 0) return;
> >
> >     String typed = params[0].toString();
> >     String[] ret = findCompletions(typed);
> >     cycle.setServiceParameters(ret);
> >  }
> >
> > Finally, back in the HTML define the function recvCompletions() to
handle
> > the returned completions:
> >
> > function recvCompletions(arr) {
> >     document.f.comps.value = arr.join("\n");
> > }
> >
> > That's all. The component produces the other necessary Javascript and
> > registers the needed Tapestry service to handle the rest.
> >
> > Note that while this code has been in circulation for a while, it has
been
> > repackaged and refurbished, so it might cause some problems. It has not
been
> > tested with a very wide variety of browsers, although it does work with
> > Firefox and IE. Any help there is appreciated :)
> >
> > Finally, a lot of other dynamic components can be very easily produced
using
> > XTile, such as a proper  completion text field (not just a quick demo),
a
> > spelling checker, etc. A lot of ideas were described in earlier messages
in
> > this list. If anyone wants work on that, please let me know -- I would
be
> > happy to lend a hand.
> >
> > Best regards,
> > -mb
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> -- 
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Harish Krishnaswamy <ha...@gmail.com>.
I agree that stuffing values in the cycle does not lend to a clear
interface but I do like the fact that the XML generation is
centralized in the service rather than having the client deal with it.
Now, if we wrap this generic component with more specific components,
the client becomes very clean and would demonstrate the real power of
Tapestry. Nevertheless this is a great start. Nice work!

-Harish


On Fri, 25 Mar 2005 11:49:31 -0500, Howard Lewis Ship <hl...@gmail.com> wrote:
> Interesting approach, using the service parameters as a way to
> communicate back to the client.
> 
> My thoughts on this were more structured; the page/component would
> implement an interface (somewhat like IExternalPage) and the method
> invoked would return a simple string.  I expect a whole famility of
> different services that expect the result to be strings, or XML/HTML,
> or whatever else.
> 
> Anyway, people are clammoring for this stuff; I wish I had the spare
> cycles to deal with this immediately.  Great job as usual!
> 
> 
> On Fri, 25 Mar 2005 18:41:44 +0200, Mind Bridge <mi...@yahoo.com> wrote:
> > Hi all,
> >
> > I have put the XTile component on T-Deli (www.t-deli.com).
> >
> > This component allows a simple JavaScript function call to invoke a listener
> > on the server and pass data to it using the now popular XMLHttpRequest
> > mechanism. The listener can also return data, and another Javascript
> > function will be invoked when it is received.
> >
> > In short, this makes using XMLHttpRequest as simple as using a DirectLink.
> >
> > Here is a quick example of this functionality:
> > http://www.t-deli.com/ex1/app?service=page/XTileTest
> >
> > Basically, it is a name completion along the lines of Google Suggest. When
> > you start typing the name of a country, the web page will ask the server for
> > possible completions. The completions will be then displayed underneath.
> >
> > Implementing this functionality is simple. First declare the XTile component
> > in your page:
> >
> >     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
> >         sendName="sendValue" receiveName="recvCompletions"/>
> >
> > The above means that when the JavaScript function sendValue() is called, the
> > handleCallback listener will be invoked, and that when it finishes, the
> > recvCompletions() function on the client must be called.
> >
> > The text field is then modified to call sendValue() when a modification
> > occurs:
> >
> >  <input onkeyup="sendValue(this.value)" .../>
> >
> > The handleCallback() listener is implemented in the Java code to generate
> > the completions:
> >
> > public void handleCallback(IRequestCycle cycle)
> >  {
> >     Object[] params = cycle.getServiceParameters();
> >     if (params.length == 0) return;
> >
> >     String typed = params[0].toString();
> >     String[] ret = findCompletions(typed);
> >     cycle.setServiceParameters(ret);
> >  }
> >
> > Finally, back in the HTML define the function recvCompletions() to handle
> > the returned completions:
> >
> > function recvCompletions(arr) {
> >     document.f.comps.value = arr.join("\n");
> > }
> >
> > That's all. The component produces the other necessary Javascript and
> > registers the needed Tapestry service to handle the rest.
> >
> > Note that while this code has been in circulation for a while, it has been
> > repackaged and refurbished, so it might cause some problems. It has not been
> > tested with a very wide variety of browsers, although it does work with
> > Firefox and IE. Any help there is appreciated :)
> >
> > Finally, a lot of other dynamic components can be very easily produced using
> > XTile, such as a proper  completion text field (not just a quick demo), a
> > spelling checker, etc. A lot of ideas were described in earlier messages in
> > this list. If anyone wants work on that, please let me know -- I would be
> > happy to lend a hand.
> >
> > Best regards,
> > -mb
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> --
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: XTile: integrating XMLHttpRequest (aka Ajax) with Tapestry

Posted by Howard Lewis Ship <hl...@gmail.com>.
Interesting approach, using the service parameters as a way to
communicate back to the client.

My thoughts on this were more structured; the page/component would
implement an interface (somewhat like IExternalPage) and the method
invoked would return a simple string.  I expect a whole famility of
different services that expect the result to be strings, or XML/HTML,
or whatever else.

Anyway, people are clammoring for this stuff; I wish I had the spare
cycles to deal with this immediately.  Great job as usual!


On Fri, 25 Mar 2005 18:41:44 +0200, Mind Bridge <mi...@yahoo.com> wrote:
> Hi all,
> 
> I have put the XTile component on T-Deli (www.t-deli.com).
> 
> This component allows a simple JavaScript function call to invoke a listener
> on the server and pass data to it using the now popular XMLHttpRequest
> mechanism. The listener can also return data, and another Javascript
> function will be invoked when it is received.
> 
> In short, this makes using XMLHttpRequest as simple as using a DirectLink.
> 
> Here is a quick example of this functionality:
> http://www.t-deli.com/ex1/app?service=page/XTileTest
> 
> Basically, it is a name completion along the lines of Google Suggest. When
> you start typing the name of a country, the web page will ask the server for
> possible completions. The completions will be then displayed underneath.
> 
> Implementing this functionality is simple. First declare the XTile component
> in your page:
> 
>     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>         sendName="sendValue" receiveName="recvCompletions"/>
> 
> The above means that when the JavaScript function sendValue() is called, the
> handleCallback listener will be invoked, and that when it finishes, the
> recvCompletions() function on the client must be called.
> 
> The text field is then modified to call sendValue() when a modification
> occurs:
> 
>  <input onkeyup="sendValue(this.value)" .../>
> 
> The handleCallback() listener is implemented in the Java code to generate
> the completions:
> 
> public void handleCallback(IRequestCycle cycle)
>  {
>     Object[] params = cycle.getServiceParameters();
>     if (params.length == 0) return;
> 
>     String typed = params[0].toString();
>     String[] ret = findCompletions(typed);
>     cycle.setServiceParameters(ret);
>  }
> 
> Finally, back in the HTML define the function recvCompletions() to handle
> the returned completions:
> 
> function recvCompletions(arr) {
>     document.f.comps.value = arr.join("\n");
> }
> 
> That's all. The component produces the other necessary Javascript and
> registers the needed Tapestry service to handle the rest.
> 
> Note that while this code has been in circulation for a while, it has been
> repackaged and refurbished, so it might cause some problems. It has not been
> tested with a very wide variety of browsers, although it does work with
> Firefox and IE. Any help there is appreciated :)
> 
> Finally, a lot of other dynamic components can be very easily produced using
> XTile, such as a proper  completion text field (not just a quick demo), a
> spelling checker, etc. A lot of ideas were described in earlier messages in
> this list. If anyone wants work on that, please let me know -- I would be
> happy to lend a hand.
> 
> Best regards,
> -mb
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org