You don't make a link to a service, what you can do is create a link
to a component (including a pgae).

Here's an example, off the top of my head (with errors, etc.), for a
chart-like service:

HTML:

<img src="${chartURL}"/>

Java:

@Inject
private MyChartService _chartService;

@Inject
private ComponentResources _resources;

public Link getChartURL()
{
 Link link = _resources.createActionLink("chart", false);

 // Can add query parameters to link here.

 return link;
}

// Invoked in second request:
public StreamResponse onChart()
{
 // Do something with _chartService.
 // Return a StreamReponse wrapper around the gif/png/jpeg bytestream
from the service

 return ...;
}

Notice how we build a "chart" event request link, then the handler
method, onChart(), is invoked for us.

For JavaScript/Ajax; we'll generate a Link and convert it to a string,
include it in a block of generated JavaScript.  Check out the
PageRenderSupport interface:

http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/PageRenderSupport.html

The StreamResponse may send back text, markup or binary that is
meaningful for the client-side JavaScript.

T5's Ajax support will include easy support for responding to a
request by sending a JSON response used to update portions of the
page.



On 7/9/07, Ben Acker <[EMAIL PROTECTED]> wrote:
I think the main thing that Matt wants is to:

a.) know how to get a link to a home-brewed service

and

b.) know how to access that from a javascript call.

I don't know how to get the link to access the T5 service, but here's a good
link for a simple javascript call.

http://www.w3schools.com/ajax/default.asp



On 7/9/07, Davor Hrg <[EMAIL PROTECTED]> wrote:
>
> Please give some more detail on what you are trying to acheive.
>
> Ajax infrastructure is not yet defined(I thin so at least) for T5,
> however, T5 already can do varios tasks very well, so do tell what are you
> trying to acheive.
>
> Davor Hrg
>
> On 7/6/07, Matt Coatney <[EMAIL PROTECTED]> wrote:
> >
> > Hello and thanks in advance!
> >
> >
> >
> > I'm new to Tapestry and working on a T5 project. I found a T4 tutorial
> > that
> > described something similar to what I need to achieve, only to realize
> > that
> > T5 does things differently. Can anyone provide a tutorial or example
> that
> > describes all or part of the following:
> >
> >
> >
> > I need to call a tapestry service from a Javascript function. The
> service
> > generates a page then updates the Src of an Iframe setting it to the
> newly
> > generated page.
> >
> >
> > Thanks,
> >
> > Matt
> >
> >
>



--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

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

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

Reply via email to