You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "C.Rigby" <cr...@gmail.com> on 2011/11/30 20:38:19 UTC

Tapestry5 Anchor Usage for Navigation

I'm developing a single page AJAX webapp with Tapestry 5 and Dojo.  I'd like
to allow the forward and back browser buttons to work, as well as allowing
users to share bookmarks within the app.  I've been reading up on using
anchors to capture the application state.  Something like this in PHP:
http://yensdesign.com/2008/11/creating-ajax-websites-based-on-anchor-navigation/

Two questions:
1. Is there a "proper" way to implement anchor usage for AJAX webapps using
Tapestry or should I just code all of the handlers in JS?  Tapestry seems
very much geared for multi-page applications, but does incorporate some nice
AJAX functionality for what I'm trying to accomplish.  I'm curious if anyone
has successfully implemented something like this.

2. Can the anchor context in a URL be retrieved from the onActivate()
function of a page?  In other words, if I want to allow a user to bookmark a
"page", can I set up the onActivate function to parse the incoming anchor
tag and initialize the page appropriately.


Thanks for any guidance anyone can give!

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036547.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
So, I've ended up with this solution:

https://gist.github.com/xfyre/7369149

It kinda works. There are few things I don't like about it:

- it uses InternalComponentResources (which is, in fact, internal interface
not exposed as a public API)
- currently it supports only EventLink (though it may be easily extended to
use with ActionLink as well)
- if user loads an URL from browser history (or enters address into
location bar), we still have to load the page with it's default state and
THEN update relevant zone, which results in two consecutive requests

Any suggestions how to improve it are kindly appreciated.



On Wed, Nov 6, 2013 at 6:41 AM, Ilya Obshadko <il...@gmail.com>wrote:

> Yes, that looks much better than what I've originally proposed. Thanks.
>
>
> On Tue, Nov 5, 2013 at 11:22 PM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
>> On Tue, 05 Nov 2013 17:11:17 -0200, Ilya Obshadko <
>> ilya.obshadko@gmail.com> wrote:
>>
>>  I've researched this problem a little bit and have an interesting
>>> question.
>>>
>>> I would like to have a customized version of ActionLink (let's call it
>>> HashActionLink). It should work as follows:
>>>
>>> - if client-side JavaScript is enabled (and thus history events work), it
>>> reacts to hash change events and updates specified zone
>>> - if client-side JavaScript is disabled, it falls back to normal
>>> ActionLink
>>> behavior
>>>
>>> I suppose it might be handled using JS DOM manipulation in @AfterRender
>>> phase.
>>> Are there any other options to do that?
>>>
>>
>> You can do this with an ordinary ActionLink or EventLink and do the logic
>> you describe in JavaScript, listening to clicks to the link and stopping
>> its propagation so the browser doesn't do the normal link behavior. For
>> monitoring hash changes, you can try some JavaScript library that can do
>> that.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
Yes, that looks much better than what I've originally proposed. Thanks.


On Tue, Nov 5, 2013 at 11:22 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Tue, 05 Nov 2013 17:11:17 -0200, Ilya Obshadko <il...@gmail.com>
> wrote:
>
>  I've researched this problem a little bit and have an interesting
>> question.
>>
>> I would like to have a customized version of ActionLink (let's call it
>> HashActionLink). It should work as follows:
>>
>> - if client-side JavaScript is enabled (and thus history events work), it
>> reacts to hash change events and updates specified zone
>> - if client-side JavaScript is disabled, it falls back to normal
>> ActionLink
>> behavior
>>
>> I suppose it might be handled using JS DOM manipulation in @AfterRender
>> phase.
>> Are there any other options to do that?
>>
>
> You can do this with an ordinary ActionLink or EventLink and do the logic
> you describe in JavaScript, listening to clicks to the link and stopping
> its propagation so the browser doesn't do the normal link behavior. For
> monitoring hash changes, you can try some JavaScript library that can do
> that.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 05 Nov 2013 17:11:17 -0200, Ilya Obshadko  
<il...@gmail.com> wrote:

> I've researched this problem a little bit and have an interesting  
> question.
>
> I would like to have a customized version of ActionLink (let's call it
> HashActionLink). It should work as follows:
>
> - if client-side JavaScript is enabled (and thus history events work), it
> reacts to hash change events and updates specified zone
> - if client-side JavaScript is disabled, it falls back to normal  
> ActionLink
> behavior
>
> I suppose it might be handled using JS DOM manipulation in @AfterRender
> phase.
> Are there any other options to do that?

You can do this with an ordinary ActionLink or EventLink and do the logic  
you describe in JavaScript, listening to clicks to the link and stopping  
its propagation so the browser doesn't do the normal link behavior. For  
monitoring hash changes, you can try some JavaScript library that can do  
that.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
I've researched this problem a little bit and have an interesting question.

I would like to have a customized version of ActionLink (let's call it
HashActionLink). It should work as follows:

- if client-side JavaScript is enabled (and thus history events work), it
reacts to hash change events and updates specified zone
- if client-side JavaScript is disabled, it falls back to normal ActionLink
behavior

I suppose it might be handled using JS DOM manipulation in @AfterRender
phase.
Are there any other options to do that?



On Sun, Oct 27, 2013 at 4:24 PM, Ilya Obshadko <il...@gmail.com>wrote:

> Thanks for suggestions. I'm going to take a look at jquery-hashchange.
>
>
> On Sun, Oct 27, 2013 at 9:07 PM, Dmitry Gusev <dm...@gmail.com>wrote:
>
>> I wouldn't expect this functionality from Tapestry, because it can't and
>> shouldn't compete with client-side frameworks that should do this job.
>>
>> Tapestry 5.4 allows better pluggable client-site integration, so using
>> some
>> 3rd party client-side library for this stuff sounds reasonable. I'm sure
>> you've heard of this resource: http://todomvc.com and I'd try picking one
>> from there to integrate with tapestry.
>>
>> To start I'd recommend you to look at
>> http://benalman.com/projects/jquery-hashchange-plugin/ and maybe to
>> http://backbonejs.org/#Router as an example of handling hashchanged in
>> client-side MV* frameworks.
>>
>> I found jquery-hashchange-plugin very handy and it works very well for
>> simple cases where you simply want to trigger zone update from client-side
>> on hash changed (or initial page load).
>>
>>
>>
>> On Sun, Oct 27, 2013 at 12:41 PM, Ilya Obshadko <ilya.obshadko@gmail.com
>> >wrote:
>>
>> > That's understandable. However, *client-side* part of Tapestry might
>> deal
>> > with URL anchors in one way or another, for example, transforming them
>> to
>> > some kind of component events being sent to server over AJAX.
>> >
>> > This is actually what I'm interested in: to create some kind of 'bridge'
>> > between browser history events and Tapestry server-side events.
>> >
>> >
>> > On Sat, Oct 26, 2013 at 5:06 PM, Dmitry Gusev <dmitry.gusev@gmail.com
>> > >wrote:
>> >
>> > > Please note:
>> > >
>> > > Anchors or URL fragments as they are referred to in RFC
>> > > 1738<http://www.ietf.org/rfc/rfc1738.txt>,
>> > > > are not sent by the client to the server, when requesting for a
>> > resource.
>> > > >
>> > >
>> > >
>> > > So dealing with anchors is completely client-side job.
>> > >
>> > > Of course you can redirect from server-side to anchored URL.
>> > >
>> > >
>> > >
>> > > On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <
>> ilya.obshadko@gmail.com
>> > > >wrote:
>> > >
>> > > > Found this thread while looking for a similar solution.
>> > > >
>> > > > - I'm using AJAX calls heavily and still want to be able to
>> represent
>> > > each
>> > > > page state as a separate URL.
>> > > > - I need to use anchor part of the URL in page activation handlers
>> > > >
>> > > > Is there any proper way to do that in 5.4?
>> > > >
>> > > >
>> > > >
>> > > > On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:
>> > > >
>> > > > > I was thinking about using that same library and gave up on the
>> whole
>> > > > idea
>> > > > > because of the emailing links problem and just went back to
>> reloading
>> > > the
>> > > > > whole page. The URL changes and the content changes. IMHO that is
>> the
>> > > > "more
>> > > > > native" approach. The history.js approach is full of difficult
>> > problems
>> > > > > such
>> > > > > as emailing a link to someone that does not run javascript.
>> Perhaps
>> > you
>> > > > > don't care about that edge case but I decided it was better to
>> > > > concentrate
>> > > > > on making the whole page load faster than solving all the AJAX
>> > history
>> > > > > problems. That said I do see the appeal and if everything
>> supported
>> > the
>> > > > > HTML
>> > > > > 5 way I might feel differently. I'm not knocking history.js and I
>> > think
>> > > > > #state is a cleaver hack but if the goal is to email links I think
>> > > > > reloading
>> > > > > the whole page is the only solution.
>> > > > >
>> > > > > --
>> > > > > View this message in context:
>> > > > >
>> > > >
>> > >
>> >
>> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
>> > > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
>> > > > >
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Ilya Obshadko
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Dmitry Gusev
>> > >
>> > > AnjLab Team
>> > > http://anjlab.com
>> > >
>> >
>> >
>> >
>> > --
>> > Ilya Obshadko
>> >
>>
>>
>>
>> --
>> Dmitry Gusev
>>
>> AnjLab Team
>> http://anjlab.com
>>
>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
Thanks for suggestions. I'm going to take a look at jquery-hashchange.


On Sun, Oct 27, 2013 at 9:07 PM, Dmitry Gusev <dm...@gmail.com>wrote:

> I wouldn't expect this functionality from Tapestry, because it can't and
> shouldn't compete with client-side frameworks that should do this job.
>
> Tapestry 5.4 allows better pluggable client-site integration, so using some
> 3rd party client-side library for this stuff sounds reasonable. I'm sure
> you've heard of this resource: http://todomvc.com and I'd try picking one
> from there to integrate with tapestry.
>
> To start I'd recommend you to look at
> http://benalman.com/projects/jquery-hashchange-plugin/ and maybe to
> http://backbonejs.org/#Router as an example of handling hashchanged in
> client-side MV* frameworks.
>
> I found jquery-hashchange-plugin very handy and it works very well for
> simple cases where you simply want to trigger zone update from client-side
> on hash changed (or initial page load).
>
>
>
> On Sun, Oct 27, 2013 at 12:41 PM, Ilya Obshadko <ilya.obshadko@gmail.com
> >wrote:
>
> > That's understandable. However, *client-side* part of Tapestry might deal
> > with URL anchors in one way or another, for example, transforming them to
> > some kind of component events being sent to server over AJAX.
> >
> > This is actually what I'm interested in: to create some kind of 'bridge'
> > between browser history events and Tapestry server-side events.
> >
> >
> > On Sat, Oct 26, 2013 at 5:06 PM, Dmitry Gusev <dmitry.gusev@gmail.com
> > >wrote:
> >
> > > Please note:
> > >
> > > Anchors or URL fragments as they are referred to in RFC
> > > 1738<http://www.ietf.org/rfc/rfc1738.txt>,
> > > > are not sent by the client to the server, when requesting for a
> > resource.
> > > >
> > >
> > >
> > > So dealing with anchors is completely client-side job.
> > >
> > > Of course you can redirect from server-side to anchored URL.
> > >
> > >
> > >
> > > On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <
> ilya.obshadko@gmail.com
> > > >wrote:
> > >
> > > > Found this thread while looking for a similar solution.
> > > >
> > > > - I'm using AJAX calls heavily and still want to be able to represent
> > > each
> > > > page state as a separate URL.
> > > > - I need to use anchor part of the URL in page activation handlers
> > > >
> > > > Is there any proper way to do that in 5.4?
> > > >
> > > >
> > > >
> > > > On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:
> > > >
> > > > > I was thinking about using that same library and gave up on the
> whole
> > > > idea
> > > > > because of the emailing links problem and just went back to
> reloading
> > > the
> > > > > whole page. The URL changes and the content changes. IMHO that is
> the
> > > > "more
> > > > > native" approach. The history.js approach is full of difficult
> > problems
> > > > > such
> > > > > as emailing a link to someone that does not run javascript. Perhaps
> > you
> > > > > don't care about that edge case but I decided it was better to
> > > > concentrate
> > > > > on making the whole page load faster than solving all the AJAX
> > history
> > > > > problems. That said I do see the appeal and if everything supported
> > the
> > > > > HTML
> > > > > 5 way I might feel differently. I'm not knocking history.js and I
> > think
> > > > > #state is a cleaver hack but if the goal is to email links I think
> > > > > reloading
> > > > > the whole page is the only solution.
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
> > > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Ilya Obshadko
> > > >
> > >
> > >
> > >
> > > --
> > > Dmitry Gusev
> > >
> > > AnjLab Team
> > > http://anjlab.com
> > >
> >
> >
> >
> > --
> > Ilya Obshadko
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>



-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by Dmitry Gusev <dm...@gmail.com>.
I wouldn't expect this functionality from Tapestry, because it can't and
shouldn't compete with client-side frameworks that should do this job.

Tapestry 5.4 allows better pluggable client-site integration, so using some
3rd party client-side library for this stuff sounds reasonable. I'm sure
you've heard of this resource: http://todomvc.com and I'd try picking one
from there to integrate with tapestry.

To start I'd recommend you to look at
http://benalman.com/projects/jquery-hashchange-plugin/ and maybe to
http://backbonejs.org/#Router as an example of handling hashchanged in
client-side MV* frameworks.

I found jquery-hashchange-plugin very handy and it works very well for
simple cases where you simply want to trigger zone update from client-side
on hash changed (or initial page load).



On Sun, Oct 27, 2013 at 12:41 PM, Ilya Obshadko <il...@gmail.com>wrote:

> That's understandable. However, *client-side* part of Tapestry might deal
> with URL anchors in one way or another, for example, transforming them to
> some kind of component events being sent to server over AJAX.
>
> This is actually what I'm interested in: to create some kind of 'bridge'
> between browser history events and Tapestry server-side events.
>
>
> On Sat, Oct 26, 2013 at 5:06 PM, Dmitry Gusev <dmitry.gusev@gmail.com
> >wrote:
>
> > Please note:
> >
> > Anchors or URL fragments as they are referred to in RFC
> > 1738<http://www.ietf.org/rfc/rfc1738.txt>,
> > > are not sent by the client to the server, when requesting for a
> resource.
> > >
> >
> >
> > So dealing with anchors is completely client-side job.
> >
> > Of course you can redirect from server-side to anchored URL.
> >
> >
> >
> > On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <ilya.obshadko@gmail.com
> > >wrote:
> >
> > > Found this thread while looking for a similar solution.
> > >
> > > - I'm using AJAX calls heavily and still want to be able to represent
> > each
> > > page state as a separate URL.
> > > - I need to use anchor part of the URL in page activation handlers
> > >
> > > Is there any proper way to do that in 5.4?
> > >
> > >
> > >
> > > On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:
> > >
> > > > I was thinking about using that same library and gave up on the whole
> > > idea
> > > > because of the emailing links problem and just went back to reloading
> > the
> > > > whole page. The URL changes and the content changes. IMHO that is the
> > > "more
> > > > native" approach. The history.js approach is full of difficult
> problems
> > > > such
> > > > as emailing a link to someone that does not run javascript. Perhaps
> you
> > > > don't care about that edge case but I decided it was better to
> > > concentrate
> > > > on making the whole page load faster than solving all the AJAX
> history
> > > > problems. That said I do see the appeal and if everything supported
> the
> > > > HTML
> > > > 5 way I might feel differently. I'm not knocking history.js and I
> think
> > > > #state is a cleaver hack but if the goal is to email links I think
> > > > reloading
> > > > the whole page is the only solution.
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
> > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Ilya Obshadko
> > >
> >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>
>
>
> --
> Ilya Obshadko
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
That's understandable. However, *client-side* part of Tapestry might deal
with URL anchors in one way or another, for example, transforming them to
some kind of component events being sent to server over AJAX.

This is actually what I'm interested in: to create some kind of 'bridge'
between browser history events and Tapestry server-side events.


On Sat, Oct 26, 2013 at 5:06 PM, Dmitry Gusev <dm...@gmail.com>wrote:

> Please note:
>
> Anchors or URL fragments as they are referred to in RFC
> 1738<http://www.ietf.org/rfc/rfc1738.txt>,
> > are not sent by the client to the server, when requesting for a resource.
> >
>
>
> So dealing with anchors is completely client-side job.
>
> Of course you can redirect from server-side to anchored URL.
>
>
>
> On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <ilya.obshadko@gmail.com
> >wrote:
>
> > Found this thread while looking for a similar solution.
> >
> > - I'm using AJAX calls heavily and still want to be able to represent
> each
> > page state as a separate URL.
> > - I need to use anchor part of the URL in page activation handlers
> >
> > Is there any proper way to do that in 5.4?
> >
> >
> >
> > On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:
> >
> > > I was thinking about using that same library and gave up on the whole
> > idea
> > > because of the emailing links problem and just went back to reloading
> the
> > > whole page. The URL changes and the content changes. IMHO that is the
> > "more
> > > native" approach. The history.js approach is full of difficult problems
> > > such
> > > as emailing a link to someone that does not run javascript. Perhaps you
> > > don't care about that edge case but I decided it was better to
> > concentrate
> > > on making the whole page load faster than solving all the AJAX history
> > > problems. That said I do see the appeal and if everything supported the
> > > HTML
> > > 5 way I might feel differently. I'm not knocking history.js and I think
> > > #state is a cleaver hack but if the goal is to email links I think
> > > reloading
> > > the whole page is the only solution.
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
> > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Ilya Obshadko
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>



-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by Dmitry Gusev <dm...@gmail.com>.
Please note:

Anchors or URL fragments as they are referred to in RFC
1738<http://www.ietf.org/rfc/rfc1738.txt>,
> are not sent by the client to the server, when requesting for a resource.
>


So dealing with anchors is completely client-side job.

Of course you can redirect from server-side to anchored URL.



On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <il...@gmail.com>wrote:

> Found this thread while looking for a similar solution.
>
> - I'm using AJAX calls heavily and still want to be able to represent each
> page state as a separate URL.
> - I need to use anchor part of the URL in page activation handlers
>
> Is there any proper way to do that in 5.4?
>
>
>
> On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:
>
> > I was thinking about using that same library and gave up on the whole
> idea
> > because of the emailing links problem and just went back to reloading the
> > whole page. The URL changes and the content changes. IMHO that is the
> "more
> > native" approach. The history.js approach is full of difficult problems
> > such
> > as emailing a link to someone that does not run javascript. Perhaps you
> > don't care about that edge case but I decided it was better to
> concentrate
> > on making the whole page load faster than solving all the AJAX history
> > problems. That said I do see the appeal and if everything supported the
> > HTML
> > 5 way I might feel differently. I'm not knocking history.js and I think
> > #state is a cleaver hack but if the goal is to email links I think
> > reloading
> > the whole page is the only solution.
> >
> > --
> > View this message in context:
> >
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Ilya Obshadko
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Tapestry5 Anchor Usage for Navigation

Posted by Ilya Obshadko <il...@gmail.com>.
Found this thread while looking for a similar solution.

- I'm using AJAX calls heavily and still want to be able to represent each
page state as a separate URL.
- I need to use anchor part of the URL in page activation handlers

Is there any proper way to do that in 5.4?



On Thu, Dec 1, 2011 at 8:04 AM, trsvax <tr...@gmail.com> wrote:

> I was thinking about using that same library and gave up on the whole idea
> because of the emailing links problem and just went back to reloading the
> whole page. The URL changes and the content changes. IMHO that is the "more
> native" approach. The history.js approach is full of difficult problems
> such
> as emailing a link to someone that does not run javascript. Perhaps you
> don't care about that edge case but I decided it was better to concentrate
> on making the whole page load faster than solving all the AJAX history
> problems. That said I do see the appeal and if everything supported the
> HTML
> 5 way I might feel differently. I'm not knocking history.js and I think
> #state is a cleaver hack but if the goal is to email links I think
> reloading
> the whole page is the only solution.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko

Re: Tapestry5 Anchor Usage for Navigation

Posted by trsvax <tr...@gmail.com>.
I was thinking about using that same library and gave up on the whole idea
because of the emailing links problem and just went back to reloading the
whole page. The URL changes and the content changes. IMHO that is the "more
native" approach. The history.js approach is full of difficult problems such
as emailing a link to someone that does not run javascript. Perhaps you
don't care about that edge case but I decided it was better to concentrate
on making the whole page load faster than solving all the AJAX history
problems. That said I do see the appeal and if everything supported the HTML
5 way I might feel differently. I'm not knocking history.js and I think
#state is a cleaver hack but if the goal is to email links I think reloading
the whole page is the only solution.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Tapestry5 Anchor Usage for Navigation

Posted by Jon Williams <wi...@gmail.com>.
Why are you using Dojo? That crap got jettisoned after Tapestry 4. Use
JQuery extension for Tapestry 5 IMO.

Peace
Jon

On Wed, Nov 30, 2011 at 2:16 PM, C.Rigby <cr...@gmail.com> wrote:

> Thanks!  This looks interesting and I'll definitely check it out.  One
> issue
> I initially see with it is the demo's URL (on Safari -- HTML5) didn't
> change
> on state changes.  This would be problematic in cases where an HTML5 user
> wanted to share a state "bookmark" with an HTML4 user.  I imagine this
> would
> have to be managed manually with JS URL updates.
>
> If anyone has another "more native" Tapestry5 solution, please share!
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036631.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Tapestry5 Anchor Usage for Navigation

Posted by "C.Rigby" <cr...@gmail.com>.
Thanks!  This looks interesting and I'll definitely check it out.  One issue
I initially see with it is the demo's URL (on Safari -- HTML5) didn't change
on state changes.  This would be problematic in cases where an HTML5 user
wanted to share a state "bookmark" with an HTML4 user.  I imagine this would
have to be managed manually with JS URL updates.

If anyone has another "more native" Tapestry5 solution, please share!

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036631.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Tapestry5 Anchor Usage for Navigation

Posted by Dragan Sahpaski <dr...@gmail.com>.
On Wed, Nov 30, 2011 at 8:38 PM, C.Rigby <cr...@gmail.com> wrote:

> I'm developing a single page AJAX webapp with Tapestry 5 and Dojo.  I'd
> like
> to allow the forward and back browser buttons to work, as well as allowing
> users to share bookmarks within the app.  I've been reading up on using
> anchors to capture the application state.  Something like this in PHP:
>
> http://yensdesign.com/2008/11/creating-ajax-websites-based-on-anchor-navigation/
>
> Two questions:
> 1. Is there a "proper" way to implement anchor usage for AJAX webapps using
> Tapestry or should I just code all of the handlers in JS?  Tapestry seems
> very much geared for multi-page applications, but does incorporate some
> nice
> AJAX functionality for what I'm trying to accomplish.  I'm curious if
> anyone
> has successfully implemented something like this.
>

I've been thinking about it but haven't actually tried it. What I would use
is https://github.com/balupton/History.js/


>
> 2. Can the anchor context in a URL be retrieved from the onActivate()
> function of a page?  In other words, if I want to allow a user to bookmark
> a
> "page", can I set up the onActivate function to parse the incoming anchor
> tag and initialize the page appropriately.
>

I think history.js makes ajax calls using urls that you define (think about
making these url's as event links using ComponentResources) and you can
listen to events in a tapestry page/component.

The anchors are fallback for html4, I like the idea behind history.js
because it also covers html5 browsers without using anchors. So basically
think/work with them as states not just anchors in a url.

Hope it helps a bit.

Cheers


>
> Thanks for any guidance anyone can give!
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036547.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>