You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Beshai <pb...@hotmail.com> on 2006/10/19 17:41:30 UTC

Link to listener on another page (not in same package)

Say I have two Tapestry applications (app1 and app2) and there is a listener 
in app2 that I want to call from app1.. is it possible? I imagine it is, but 
I am lost as to how to implement it.

Basically, I have an application that handles bookmarks(app2). In app1 I can 
upload a file and bookmark the link to it on the server (but all the editing 
of the bookmark thereafter would happen in app2). So after 
uploading/bookmarking[adding to the bookmark db] in app1, I want to post a 
link to edit the bookmark. So I essentially want to call the edit bookmark 
listener in app2 with a parameter from app1 (ie the bookmark id).

My edit listener in app2 looks like this:
public IPage onEditLink(IRequestCycle cycle, Serializable bookmarkId)
    {
        AddBookmark page=getAddBookmarkPage();
        page.setBookmarkId(bookmarkId);
        return page;
    }

I'm not sure how to implement the right kind of listener in app1 to have it 
do the same thing (essentially).

Any suggestions?

Peter Beshai

_________________________________________________________________
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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


Re: Link to listener on another page (not in same package)

Posted by Sam Gendler <sg...@ideasculptor.com>.
You can't just call a method in an instance of an object that is in a
different app.  That's not possible short of using some kind of rpc
mechanism between the two applications.  But you can provide a link
which will take the user to a page in app2 and cause a listener to be
executed.  If you want to be able to receive parameters in the URL
string for a page, have that page implement IExternalPage.  The
signature method for that interface receives an array of parameters,
which you can use to populate your page object with data before it
renders.  I don't know, offhand, of a way to cause a listener to be
called automatically, but you could just call a listener method
manually in activateExternalPage() after you've populated your page
with data.  That would be the equivalent of having a listener attached
to a form, which gets called just before the page enters its rewind
cycle.  So as long as app1 can provide a querystring in the format
understood by the External service, then you can provide such a link.
Alternatively, instead of using the standard tapestry parameter
structure, you can just use normal name/value query string pairs, and
get the values out of the ServletRequest yourself.  This is the only
way to have a form in one app post directly a page in another app
short of writing javascript to manipulate the outgoing query
parameters.

--sam

On 10/19/06, Peter Beshai <pb...@hotmail.com> wrote:
> Say I have two Tapestry applications (app1 and app2) and there is a listener
> in app2 that I want to call from app1.. is it possible? I imagine it is, but
> I am lost as to how to implement it.
>
> Basically, I have an application that handles bookmarks(app2). In app1 I can
> upload a file and bookmark the link to it on the server (but all the editing
> of the bookmark thereafter would happen in app2). So after
> uploading/bookmarking[adding to the bookmark db] in app1, I want to post a
> link to edit the bookmark. So I essentially want to call the edit bookmark
> listener in app2 with a parameter from app1 (ie the bookmark id).
>
> My edit listener in app2 looks like this:
> public IPage onEditLink(IRequestCycle cycle, Serializable bookmarkId)
>     {
>         AddBookmark page=getAddBookmarkPage();
>         page.setBookmarkId(bookmarkId);
>         return page;
>     }
>
> I'm not sure how to implement the right kind of listener in app1 to have it
> do the same thing (essentially).
>
> Any suggestions?
>
> Peter Beshai
>
> _________________________________________________________________
> Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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