You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Donyee <xy...@gmail.com> on 2007/10/12 06:19:14 UTC

[T5] Got a wrong uri from createActionLink!

Here is my code:
Index.java
@Inject
private ComponentResources resource;
public String getUpdateLink() {
Link link = resource.createActionLink("updateMsg", true);
return link.toURI();
}

and in Index.tml:
${updateLink}...

It displays "/index:updateMsg", it should be "/index.updateMsg"!
Is this a bug? or I made wrong?

----徐 依伟

Re: [T5] Got a wrong uri from createActionLink!

Posted by Donyee <xy...@gmail.com>.
Thanks, I changed to onUpdateMsg()!
works fine!

2007/10/12, lasitha <la...@gmail.com>:
>
> I might still not be getting it, but i'll try again :)
>
> Preamble... (see below for a possible solution):
>
> Tapestry uses the following convention for an action link:
> /page.component:action
> Periods represent nested components and colons prefix a named action.
>
> So, '/index.updatemsg' points to an 'updatemsg' component on the 'index'
> page.
> That link doesn't specify an action, but i'm guessing it'll invoke
> your 'onActionFromUpdateMsg' handler (the 'onAction' convention means
> it will fire on any action for this component), as long as Index
> contains such a component.
>
> '/index:updatemsg' signifies an action named 'updatemsg' directly on
> the 'index' page.  Again, if you don't have a handler for this action
> on the index page, then it'll probably behave similiar to a simple
> page render request - hence you're return just '/index'.
>
>
> Solution (perhaps):
>
> If i understand what you're trying to do, i think you can just change:
>     onActionFromUpdateMsg()
> to
>     onUpdateMsg()
> in Index.java.
>
> If you do this and keep the createActionLink() code the same, the URI
> will be '/index:updatemsg' and clicking it will invoke onUpdateMsg().
>
> Is that what you're looking for?
>
> Cheers,
> lasitha.
>
>
> On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > I request the /index.updatemsg and get a json data, the
> > onActionFromUpdateMsg() method works fine!
> > but i request the /index:updatemsg, it response as /index!
> > Is this new in t5.06?
> > How can i get a url like /index.updatemsg??
> > Thanks!
> >
> > 2007/10/12, lasitha <la...@gmail.com>:
> > >
> > > AFAIK, there's nothing wrong with using a colon within the path of a
> URI.
> > > Do you know of any problems with this?  Its been working so far...
> > > Perhaps i'm missing the point?
> > >
> > > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > > The colon (:) "/index:updatemsg" is not a uri,
> > > > how could  i get a "/index.updatemsg"?
> > > >
> > > > 2007/10/12, lasitha <la...@gmail.com>:
> > > > >
> > > > > Umm, looks fine to me...
> > > > >
> > > > > According to the createActionLink javadoc[1], it  creates "... a
> > > > > component action request link as a callback for this
> component."  So
> > > > > in this case, your component is the Index page, and your action is
> > > > > 'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
> > > > > opposed to a nested component (designated by the period (.)).
> > > > >
> > > > > What problems are you having with the generated link?
> > > > >
> > > > > Cheers,
> > > > > lasitha.
> > > > >
> > > > > [1]
> > > > >
> > >
> http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)
> > > > >
> > > > >
> > > > > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > > > > I use T5.06 snapshot !
> > > > > >
> > > > > > 2007/10/12, Donyee <xy...@gmail.com>:
> > > > > > >
> > > > > > >
> > > > > > > Here is my code:
> > > > > > > Index.java
> > > > > > > @Inject
> > > > > > > private ComponentResources resource;
> > > > > > > public String getUpdateLink() {
> > > > > > > Link link = resource.createActionLink("updateMsg", true);
> > > > > > > return link.toURI();
> > > > > > > }
> > > > > > >
> > > > > > > and in Index.tml:
> > > > > > > ${updateLink}...
> > > > > > >
> > > > > > > It displays "/index:updateMsg", it should be
> "/index.updateMsg"!
> > > > > > > Is this a bug? or I made wrong?
> > > > > > >
> > > > > > > ----徐 依伟
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > ----徐 依伟
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > ----徐 依伟
> > > >
> > >
> >
> >
> >
> > --
> > ----徐 依伟
> >
>



-- 
----徐 依伟

Re: [T5] Got a wrong uri from createActionLink!

Posted by lasitha <la...@gmail.com>.
I might still not be getting it, but i'll try again :)

Preamble... (see below for a possible solution):

Tapestry uses the following convention for an action link:
/page.component:action
Periods represent nested components and colons prefix a named action.

So, '/index.updatemsg' points to an 'updatemsg' component on the 'index' page.
That link doesn't specify an action, but i'm guessing it'll invoke
your 'onActionFromUpdateMsg' handler (the 'onAction' convention means
it will fire on any action for this component), as long as Index
contains such a component.

'/index:updatemsg' signifies an action named 'updatemsg' directly on
the 'index' page.  Again, if you don't have a handler for this action
on the index page, then it'll probably behave similiar to a simple
page render request - hence you're return just '/index'.


Solution (perhaps):

If i understand what you're trying to do, i think you can just change:
    onActionFromUpdateMsg()
to
    onUpdateMsg()
in Index.java.

If you do this and keep the createActionLink() code the same, the URI
will be '/index:updatemsg' and clicking it will invoke onUpdateMsg().

Is that what you're looking for?

Cheers,
lasitha.


On 10/12/07, Donyee <xy...@gmail.com> wrote:
> I request the /index.updatemsg and get a json data, the
> onActionFromUpdateMsg() method works fine!
> but i request the /index:updatemsg, it response as /index!
> Is this new in t5.06?
> How can i get a url like /index.updatemsg??
> Thanks!
>
> 2007/10/12, lasitha <la...@gmail.com>:
> >
> > AFAIK, there's nothing wrong with using a colon within the path of a URI.
> > Do you know of any problems with this?  Its been working so far...
> > Perhaps i'm missing the point?
> >
> > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > The colon (:) "/index:updatemsg" is not a uri,
> > > how could  i get a "/index.updatemsg"?
> > >
> > > 2007/10/12, lasitha <la...@gmail.com>:
> > > >
> > > > Umm, looks fine to me...
> > > >
> > > > According to the createActionLink javadoc[1], it  creates "... a
> > > > component action request link as a callback for this component."  So
> > > > in this case, your component is the Index page, and your action is
> > > > 'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
> > > > opposed to a nested component (designated by the period (.)).
> > > >
> > > > What problems are you having with the generated link?
> > > >
> > > > Cheers,
> > > > lasitha.
> > > >
> > > > [1]
> > > >
> > http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)
> > > >
> > > >
> > > > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > > > I use T5.06 snapshot !
> > > > >
> > > > > 2007/10/12, Donyee <xy...@gmail.com>:
> > > > > >
> > > > > >
> > > > > > Here is my code:
> > > > > > Index.java
> > > > > > @Inject
> > > > > > private ComponentResources resource;
> > > > > > public String getUpdateLink() {
> > > > > > Link link = resource.createActionLink("updateMsg", true);
> > > > > > return link.toURI();
> > > > > > }
> > > > > >
> > > > > > and in Index.tml:
> > > > > > ${updateLink}...
> > > > > >
> > > > > > It displays "/index:updateMsg", it should be "/index.updateMsg"!
> > > > > > Is this a bug? or I made wrong?
> > > > > >
> > > > > > ----徐 依伟
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > ----徐 依伟
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > ----徐 依伟
> > >
> >
>
>
>
> --
> ----徐 依伟
>

Re: [T5] Got a wrong uri from createActionLink!

Posted by Donyee <xy...@gmail.com>.
I request the /index.updatemsg and get a json data, the
onActionFromUpdateMsg() method works fine!
but i request the /index:updatemsg, it response as /index!
Is this new in t5.06?
How can i get a url like /index.updatemsg??
Thanks!

2007/10/12, lasitha <la...@gmail.com>:
>
> AFAIK, there's nothing wrong with using a colon within the path of a URI.
> Do you know of any problems with this?  Its been working so far...
> Perhaps i'm missing the point?
>
> On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > The colon (:) "/index:updatemsg" is not a uri,
> > how could  i get a "/index.updatemsg"?
> >
> > 2007/10/12, lasitha <la...@gmail.com>:
> > >
> > > Umm, looks fine to me...
> > >
> > > According to the createActionLink javadoc[1], it  creates "... a
> > > component action request link as a callback for this component."  So
> > > in this case, your component is the Index page, and your action is
> > > 'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
> > > opposed to a nested component (designated by the period (.)).
> > >
> > > What problems are you having with the generated link?
> > >
> > > Cheers,
> > > lasitha.
> > >
> > > [1]
> > >
> http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)
> > >
> > >
> > > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > > I use T5.06 snapshot !
> > > >
> > > > 2007/10/12, Donyee <xy...@gmail.com>:
> > > > >
> > > > >
> > > > > Here is my code:
> > > > > Index.java
> > > > > @Inject
> > > > > private ComponentResources resource;
> > > > > public String getUpdateLink() {
> > > > > Link link = resource.createActionLink("updateMsg", true);
> > > > > return link.toURI();
> > > > > }
> > > > >
> > > > > and in Index.tml:
> > > > > ${updateLink}...
> > > > >
> > > > > It displays "/index:updateMsg", it should be "/index.updateMsg"!
> > > > > Is this a bug? or I made wrong?
> > > > >
> > > > > ----徐 依伟
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > ----徐 依伟
> > > >
> > >
> >
> >
> >
> > --
> > ----徐 依伟
> >
>



-- 
----徐 依伟

Re: [T5] Got a wrong uri from createActionLink!

Posted by lasitha <la...@gmail.com>.
AFAIK, there's nothing wrong with using a colon within the path of a URI.
Do you know of any problems with this?  Its been working so far...
Perhaps i'm missing the point?

On 10/12/07, Donyee <xy...@gmail.com> wrote:
> The colon (:) "/index:updatemsg" is not a uri,
> how could  i get a "/index.updatemsg"?
>
> 2007/10/12, lasitha <la...@gmail.com>:
> >
> > Umm, looks fine to me...
> >
> > According to the createActionLink javadoc[1], it  creates "... a
> > component action request link as a callback for this component."  So
> > in this case, your component is the Index page, and your action is
> > 'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
> > opposed to a nested component (designated by the period (.)).
> >
> > What problems are you having with the generated link?
> >
> > Cheers,
> > lasitha.
> >
> > [1]
> > http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)
> >
> >
> > On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > > I use T5.06 snapshot !
> > >
> > > 2007/10/12, Donyee <xy...@gmail.com>:
> > > >
> > > >
> > > > Here is my code:
> > > > Index.java
> > > > @Inject
> > > > private ComponentResources resource;
> > > > public String getUpdateLink() {
> > > > Link link = resource.createActionLink("updateMsg", true);
> > > > return link.toURI();
> > > > }
> > > >
> > > > and in Index.tml:
> > > > ${updateLink}...
> > > >
> > > > It displays "/index:updateMsg", it should be "/index.updateMsg"!
> > > > Is this a bug? or I made wrong?
> > > >
> > > > ----徐 依伟
> > > >
> > >
> > >
> > >
> > > --
> > > ----徐 依伟
> > >
> >
>
>
>
> --
> ----徐 依伟
>

Re: [T5] Got a wrong uri from createActionLink!

Posted by Donyee <xy...@gmail.com>.
The colon (:) "/index:updatemsg" is not a uri,
how could  i get a "/index.updatemsg"?

2007/10/12, lasitha <la...@gmail.com>:
>
> Umm, looks fine to me...
>
> According to the createActionLink javadoc[1], it  creates "... a
> component action request link as a callback for this component."  So
> in this case, your component is the Index page, and your action is
> 'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
> opposed to a nested component (designated by the period (.)).
>
> What problems are you having with the generated link?
>
> Cheers,
> lasitha.
>
> [1]
> http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)
>
>
> On 10/12/07, Donyee <xy...@gmail.com> wrote:
> > I use T5.06 snapshot !
> >
> > 2007/10/12, Donyee <xy...@gmail.com>:
> > >
> > >
> > > Here is my code:
> > > Index.java
> > > @Inject
> > > private ComponentResources resource;
> > > public String getUpdateLink() {
> > > Link link = resource.createActionLink("updateMsg", true);
> > > return link.toURI();
> > > }
> > >
> > > and in Index.tml:
> > > ${updateLink}...
> > >
> > > It displays "/index:updateMsg", it should be "/index.updateMsg"!
> > > Is this a bug? or I made wrong?
> > >
> > > ----徐 依伟
> > >
> >
> >
> >
> > --
> > ----徐 依伟
> >
>



-- 
----徐 依伟

Re: [T5] Got a wrong uri from createActionLink!

Posted by lasitha <la...@gmail.com>.
Umm, looks fine to me...

According to the createActionLink javadoc[1], it  creates "... a
component action request link as a callback for this component."  So
in this case, your component is the Index page, and your action is
'updateMsg'.  Tapestry uses a colon (:) to indicate an action as
opposed to a nested component (designated by the period (.)).

What problems are you having with the generated link?

Cheers,
lasitha.

[1] http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/ComponentResourcesCommon.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object...)


On 10/12/07, Donyee <xy...@gmail.com> wrote:
> I use T5.06 snapshot !
>
> 2007/10/12, Donyee <xy...@gmail.com>:
> >
> >
> > Here is my code:
> > Index.java
> > @Inject
> > private ComponentResources resource;
> > public String getUpdateLink() {
> > Link link = resource.createActionLink("updateMsg", true);
> > return link.toURI();
> > }
> >
> > and in Index.tml:
> > ${updateLink}...
> >
> > It displays "/index:updateMsg", it should be "/index.updateMsg"!
> > Is this a bug? or I made wrong?
> >
> > ----徐 依伟
> >
>
>
>
> --
> ----徐 依伟
>

Re: [T5] Got a wrong uri from createActionLink!

Posted by Donyee <xy...@gmail.com>.
I use T5.06 snapshot !

2007/10/12, Donyee <xy...@gmail.com>:
>
>
> Here is my code:
> Index.java
> @Inject
> private ComponentResources resource;
> public String getUpdateLink() {
> Link link = resource.createActionLink("updateMsg", true);
> return link.toURI();
> }
>
> and in Index.tml:
> ${updateLink}...
>
> It displays "/index:updateMsg", it should be "/index.updateMsg"!
> Is this a bug? or I made wrong?
>
> ----徐 依伟
>



-- 
----徐 依伟