You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Lydiard <dl...@hotmail.com> on 2006/02/09 21:51:35 UTC
anchors with @Shell
I'm using the @Shell which creates a base tag with the application base url.
if i do a
[a name="top"][/a]
and a link [a href="#top"]Back to top[/a]
the application won't scroll to the top of the page because of the base tag
produced by @Shell, it just goes back to the home page. Is there a quick
away around this?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: anchors with @Shell
Posted by Fernando Padilla <fe...@alum.mit.edu>.
alright, again. version 2
I reviewd the documentation on annotations and simplified the .jwc
I still want to know how to add a component to a library without a jwc file?
Fernando Padilla wrote:
> Alright, I had reason to stay up anyhow.
>
> Attached is a version of a NameLink component that takes a name
> parameter. Tapestry 4. I've tested this component only on
> linux/firefox at home, but the same technique has been working on our
> site for the last few months; I'll test this component out on a few
> other browsers tomorrow. Anyone can feel free to absorb this into
> Tapestry.
>
> comments?
>
>
> Questions: I'm trying to learn how to get rid of the jwc. Anybody know
> the last few things I need to do? ReservedParameters through
> annotations, and how to add a component to a component library without
> refering to a jwc.
>
>
>
> Fernando Padilla wrote:
>
>> I couldn't read through the threads ( didn't seem like the right
>> solution anyhow ). This is what our html developer came up with, a
>> nice javascript hack: (right off of our site) He simply created a
>> javascript function that is called that does the named-anchor
>> dereference, instead of letting the anchor-link do it (which takes
>> into account base-href).
>>
>>
>> <!-- don't reload the page when linking to anchors... -->
>> <script type="text/javascript">
>> function anchorMessages(){
>> location.hash = "messages";
>> }
>> </script>
>>
>> <a href="javascript:anchorMessages()">blah</a>
>>
>>
>>
>>
>> Wow I just realized that I could easily make a component to wrap this.
>> I'll see about that in work tomorrow, or if someone else feels like
>> it, should be pretty darn easy.
>>
>>
>>
>> Daniel Lydiard wrote:
>>
>>> This will helpful too
>>>
>>> http://www.tapestryforums.com/anchor-tags-vt2957.html?highlight=shell+anchor+base+tag
>>>
>>>
>>> ----- Original Message ----- From: "Jason Suplizio" <su...@gmail.com>
>>> To: "Tapestry users" <ta...@jakarta.apache.org>
>>> Sent: Thursday, February 09, 2006 8:37 PM
>>> Subject: Re: anchors with @Shell
>>>
>>>
>>> http://www.nabble.com/Specifying-my-own-tapestry.url.BaseTagWriter-t1049395.html
>>>
>>>
>>> On 2/9/06, Chris Chiappone <ch...@gmail.com> wrote:
>>>
>>>>
>>>> There is a lot of info on this topic. Just do a search for "anchor
>>>> tags" in the tapestryforum.
>>>>
>>>> On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
>>>> > I'm using the @Shell which creates a base tag with the application
>>>> base
>>>> url.
>>>> >
>>>> > if i do a
>>>> >
>>>> > [a name="top"][/a]
>>>> >
>>>> > and a link [a href="#top"]Back to top[/a]
>>>> >
>>>> > the application won't scroll to the top of the page because of the
>>>> base
>>>> tag
>>>> > produced by @Shell, it just goes back to the home page. Is there a
>>>> quick
>>>> > away around this?
>>>> >
>>>> > Thanks.
>>>> >
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> > For additional commands, e-mail:
>>>> tapestry-user-help@jakarta.apache.org
>>>> >
>>>> >
>>>>
>>>>
>>>> --
>>>> ~chris
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE component-specification
> PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
>
> <component-specification class="com.protrade.basesite.common.NameLink" allow-body="yes" allow-informal-parameters="yes">
> <reserved-parameter name="href"/>
> <inject property="script" type="script" object="NameLink.script"/>
> </component-specification>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE script PUBLIC
> "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
>
> <script>
> <body>
> <unique>
> function gotoNamedAnchor( name ) {
> location.hash = name;
> }
> </unique>
> </body>
> </script>
>
>
> ------------------------------------------------------------------------
>
> package com.protrade.basesite.common;
>
> import java.util.HashMap;
> import java.util.Map;
>
> import org.apache.tapestry.AbstractComponent;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.IScript;
> import org.apache.tapestry.PageRenderSupport;
> import org.apache.tapestry.TapestryUtils;
> import org.apache.tapestry.annotations.ComponentClass;
> import org.apache.tapestry.annotations.Parameter;
>
> @ComponentClass( allowBody=true, allowInformalParameters=true )
> public abstract class NameLink extends AbstractComponent {
>
> @Parameter( name="name", required=true )
> public abstract String getName();
>
> public abstract IScript getScript();
>
> protected void renderComponent( IMarkupWriter writer, IRequestCycle cycle ) {
> if ( !cycle.isRewinding() ) {
> // add javascript
> PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport( cycle, this );
> Map symbols = new HashMap();
> getScript().execute( cycle, pageRenderSupport, symbols );
> }
> writer.begin( "a" );
> writer.attribute( "href", "javascript:gotoNamedAnchor(\""+getName()+"\")" );
> renderInformalParameters( writer, cycle );
> renderBody( writer, cycle );
> writer.end();
> }
> }
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: anchors with @Shell
Posted by Fernando Padilla <fe...@alum.mit.edu>.
Alright, I had reason to stay up anyhow.
Attached is a version of a NameLink component that takes a name
parameter. Tapestry 4. I've tested this component only on
linux/firefox at home, but the same technique has been working on our
site for the last few months; I'll test this component out on a few
other browsers tomorrow. Anyone can feel free to absorb this into Tapestry.
comments?
Questions: I'm trying to learn how to get rid of the jwc. Anybody know
the last few things I need to do? ReservedParameters through
annotations, and how to add a component to a component library without
refering to a jwc.
Fernando Padilla wrote:
> I couldn't read through the threads ( didn't seem like the right
> solution anyhow ). This is what our html developer came up with, a nice
> javascript hack: (right off of our site) He simply created a javascript
> function that is called that does the named-anchor dereference, instead
> of letting the anchor-link do it (which takes into account base-href).
>
>
> <!-- don't reload the page when linking to anchors... -->
> <script type="text/javascript">
> function anchorMessages(){
> location.hash = "messages";
> }
> </script>
>
> <a href="javascript:anchorMessages()">blah</a>
>
>
>
>
> Wow I just realized that I could easily make a component to wrap this.
> I'll see about that in work tomorrow, or if someone else feels like it,
> should be pretty darn easy.
>
>
>
> Daniel Lydiard wrote:
>
>> This will helpful too
>>
>> http://www.tapestryforums.com/anchor-tags-vt2957.html?highlight=shell+anchor+base+tag
>>
>>
>> ----- Original Message ----- From: "Jason Suplizio" <su...@gmail.com>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Thursday, February 09, 2006 8:37 PM
>> Subject: Re: anchors with @Shell
>>
>>
>> http://www.nabble.com/Specifying-my-own-tapestry.url.BaseTagWriter-t1049395.html
>>
>>
>> On 2/9/06, Chris Chiappone <ch...@gmail.com> wrote:
>>
>>>
>>> There is a lot of info on this topic. Just do a search for "anchor
>>> tags" in the tapestryforum.
>>>
>>> On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
>>> > I'm using the @Shell which creates a base tag with the application
>>> base
>>> url.
>>> >
>>> > if i do a
>>> >
>>> > [a name="top"][/a]
>>> >
>>> > and a link [a href="#top"]Back to top[/a]
>>> >
>>> > the application won't scroll to the top of the page because of the
>>> base
>>> tag
>>> > produced by @Shell, it just goes back to the home page. Is there a
>>> quick
>>> > away around this?
>>> >
>>> > Thanks.
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>> >
>>> >
>>>
>>>
>>> --
>>> ~chris
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
Re: anchors with @Shell
Posted by Fernando Padilla <fe...@alum.mit.edu>.
I couldn't read through the threads ( didn't seem like the right
solution anyhow ). This is what our html developer came up with, a nice
javascript hack: (right off of our site) He simply created a javascript
function that is called that does the named-anchor dereference, instead
of letting the anchor-link do it (which takes into account base-href).
<!-- don't reload the page when linking to anchors... -->
<script type="text/javascript">
function anchorMessages(){
location.hash = "messages";
}
</script>
<a href="javascript:anchorMessages()">blah</a>
Wow I just realized that I could easily make a component to wrap this.
I'll see about that in work tomorrow, or if someone else feels like it,
should be pretty darn easy.
Daniel Lydiard wrote:
> This will helpful too
>
> http://www.tapestryforums.com/anchor-tags-vt2957.html?highlight=shell+anchor+base+tag
>
>
> ----- Original Message ----- From: "Jason Suplizio" <su...@gmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, February 09, 2006 8:37 PM
> Subject: Re: anchors with @Shell
>
>
> http://www.nabble.com/Specifying-my-own-tapestry.url.BaseTagWriter-t1049395.html
>
>
> On 2/9/06, Chris Chiappone <ch...@gmail.com> wrote:
>
>>
>> There is a lot of info on this topic. Just do a search for "anchor
>> tags" in the tapestryforum.
>>
>> On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
>> > I'm using the @Shell which creates a base tag with the application base
>> url.
>> >
>> > if i do a
>> >
>> > [a name="top"][/a]
>> >
>> > and a link [a href="#top"]Back to top[/a]
>> >
>> > the application won't scroll to the top of the page because of the base
>> tag
>> > produced by @Shell, it just goes back to the home page. Is there a
>> quick
>> > away around this?
>> >
>> > Thanks.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >
>> >
>>
>>
>> --
>> ~chris
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: anchors with @Shell
Posted by Daniel Lydiard <dl...@hotmail.com>.
This will helpful too
http://www.tapestryforums.com/anchor-tags-vt2957.html?highlight=shell+anchor+base+tag
----- Original Message -----
From: "Jason Suplizio" <su...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, February 09, 2006 8:37 PM
Subject: Re: anchors with @Shell
http://www.nabble.com/Specifying-my-own-tapestry.url.BaseTagWriter-t1049395.html
On 2/9/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> There is a lot of info on this topic. Just do a search for "anchor
> tags" in the tapestryforum.
>
> On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
> > I'm using the @Shell which creates a base tag with the application base
> url.
> >
> > if i do a
> >
> > [a name="top"][/a]
> >
> > and a link [a href="#top"]Back to top[/a]
> >
> > the application won't scroll to the top of the page because of the base
> tag
> > produced by @Shell, it just goes back to the home page. Is there a
> quick
> > away around this?
> >
> > Thanks.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> 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: anchors with @Shell
Posted by Jason Suplizio <su...@gmail.com>.
http://www.nabble.com/Specifying-my-own-tapestry.url.BaseTagWriter-t1049395.html
On 2/9/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> There is a lot of info on this topic. Just do a search for "anchor
> tags" in the tapestryforum.
>
> On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
> > I'm using the @Shell which creates a base tag with the application base
> url.
> >
> > if i do a
> >
> > [a name="top"][/a]
> >
> > and a link [a href="#top"]Back to top[/a]
> >
> > the application won't scroll to the top of the page because of the base
> tag
> > produced by @Shell, it just goes back to the home page. Is there a
> quick
> > away around this?
> >
> > Thanks.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: anchors with @Shell
Posted by Chris Chiappone <ch...@gmail.com>.
There is a lot of info on this topic. Just do a search for "anchor
tags" in the tapestryforum.
On 2/9/06, Daniel Lydiard <dl...@hotmail.com> wrote:
> I'm using the @Shell which creates a base tag with the application base url.
>
> if i do a
>
> [a name="top"][/a]
>
> and a link [a href="#top"]Back to top[/a]
>
> the application won't scroll to the top of the page because of the base tag
> produced by @Shell, it just goes back to the home page. Is there a quick
> away around this?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org