You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/11/01 11:36:31 UTC

T5: actionlink in another page/class

Hi,

I have a page which generate a link to an action in the same page, the link
was embedded in a Streamresponse, when I click the link in the browser, it
does not activate the action link created, why?

Here is the code:

public class TestPage2 {

  @Inject
   private ComponentResources resources;

   public StreamResponse onActionFromDelete(Long id) {
        String link1 =
resources.createActionLink("onActionFromDeleteConfirm", false, id).toURI();
        return new TextStreamResponse("text/html", String.format("< a
href='%s'>Confirm ", link1));
    }

   public String onActionFromDeleteConfirm(Long id) {
        System.out.println("delete confirm");
        return null;
    }
}

html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
    <title>Start Page</title>
</head>
<body>
<h1>Test Page</h1>
 <t:actionLink t:id="Delete" context="1">Delete</t:actionLink><br/>
</body>
</html>



-- 
View this message in context: http://www.nabble.com/T5%3A-actionlink-in-another-page-class-tf4730427.html#a13526220
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: T5: actionlink in another page/class

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Josh,

Thanks, it works,  so method should be declared as

OnDeleteConfirm, then createActionLink("DeleteConfirm",...)

A.C.


Josh Canfield-2 wrote:
> 
>>
>>
>> >
>> > resources.createActionLink("onActionFromDeleteConfirm", false,
>> > id).toURI();
>>
>>
>> The action you are invoking is "deleteConfirm", the event method is
>> "onActionFromDeleteConfirm" so your action link should look like this:
>>
> 
> Actually, I take that back. Your event method should be onDeleteConfirm.
> You
> aren't creating it from the action component so the "ActionFrom" part is
> not
> used.
> 
> Josh
> 
> 
> On 11/1/07, Josh Canfield <jo...@thedailytube.com> wrote:
>>
>>  resources.createActionLink("onActionFromDeleteConfirm", false,
>> > id).toURI();
>>
>>
>> The action you are invoking is "deleteConfirm", the event method is
>> "onActionFromDeleteConfirm" so your action link should look like this:
>>
>> resources.createActionLink("deleteConfirm", false, id).toURI();
>>
>> Josh
>>
>>  On 11/1/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>> >
>> >
>> > Hi,
>> >
>> > I have a page which generate a link to an action in the same page, the
>> > link
>> > was embedded in a Streamresponse, when I click the link in the browser,
>> > it
>> > does not activate the action link created, why?
>> >
>> > Here is the code:
>> >
>> > public class TestPage2 {
>> >
>> > @Inject
>> >   private ComponentResources resources;
>> >
>> >   public StreamResponse onActionFromDelete(Long id) {
>> >        String link1 =
>> > resources.createActionLink("onActionFromDeleteConfirm", false,
>> > id).toURI();
>> >        return new TextStreamResponse("text/html", String.format("< a
>> > href='%s'>Confirm ", link1));
>> >    }
>> >
>> >   public String onActionFromDeleteConfirm(Long id) {
>> >        System.out.println("delete confirm");
>> >        return null;
>> >    }
>> > }
>> >
>> > html xmlns:t=" http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> > <head>
>> >    <title>Start Page</title>
>> > </head>
>> > <body>
>> > <h1>Test Page</h1>
>> > <t:actionLink t:id="Delete" context="1">Delete</t:actionLink><br/>
>> > </body>
>> > </html>
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/T5%3A-actionlink-in-another-page-class-tf4730427.html#a13526220
>> >
>> > Sent from the Tapestry - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> > .
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>>
>> --
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
> 
> 
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-actionlink-in-another-page-class-tf4730427.html#a13539594
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: T5: actionlink in another page/class

Posted by Josh Canfield <jo...@thedailytube.com>.
>
>
> >
> > resources.createActionLink("onActionFromDeleteConfirm", false,
> > id).toURI();
>
>
> The action you are invoking is "deleteConfirm", the event method is
> "onActionFromDeleteConfirm" so your action link should look like this:
>

Actually, I take that back. Your event method should be onDeleteConfirm. You
aren't creating it from the action component so the "ActionFrom" part is not
used.

Josh


On 11/1/07, Josh Canfield <jo...@thedailytube.com> wrote:
>
>  resources.createActionLink("onActionFromDeleteConfirm", false,
> > id).toURI();
>
>
> The action you are invoking is "deleteConfirm", the event method is
> "onActionFromDeleteConfirm" so your action link should look like this:
>
> resources.createActionLink("deleteConfirm", false, id).toURI();
>
> Josh
>
>  On 11/1/07, Angelo Chen <an...@yahoo.com.hk> wrote:
> >
> >
> > Hi,
> >
> > I have a page which generate a link to an action in the same page, the
> > link
> > was embedded in a Streamresponse, when I click the link in the browser,
> > it
> > does not activate the action link created, why?
> >
> > Here is the code:
> >
> > public class TestPage2 {
> >
> > @Inject
> >   private ComponentResources resources;
> >
> >   public StreamResponse onActionFromDelete(Long id) {
> >        String link1 =
> > resources.createActionLink("onActionFromDeleteConfirm", false,
> > id).toURI();
> >        return new TextStreamResponse("text/html", String.format("< a
> > href='%s'>Confirm ", link1));
> >    }
> >
> >   public String onActionFromDeleteConfirm(Long id) {
> >        System.out.println("delete confirm");
> >        return null;
> >    }
> > }
> >
> > html xmlns:t=" http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <head>
> >    <title>Start Page</title>
> > </head>
> > <body>
> > <h1>Test Page</h1>
> > <t:actionLink t:id="Delete" context="1">Delete</t:actionLink><br/>
> > </body>
> > </html>
> >
> >
> >
> > --
> > View this message in context: http://www.nabble.com/T5%3A-actionlink-in-another-page-class-tf4730427.html#a13526220
> >
> > Sent from the Tapestry - User mailing list archive at Nabble.com<http://nabble.com/>
> > .
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.




-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: actionlink in another page/class

Posted by Josh Canfield <jo...@thedailytube.com>.
>
> resources.createActionLink("onActionFromDeleteConfirm", false,
> id).toURI();


The action you are invoking is "deleteConfirm", the event method is
"onActionFromDeleteConfirm" so your action link should look like this:

resources.createActionLink("deleteConfirm", false, id).toURI();

Josh

On 11/1/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi,
>
> I have a page which generate a link to an action in the same page, the
> link
> was embedded in a Streamresponse, when I click the link in the browser, it
> does not activate the action link created, why?
>
> Here is the code:
>
> public class TestPage2 {
>
> @Inject
>   private ComponentResources resources;
>
>   public StreamResponse onActionFromDelete(Long id) {
>        String link1 =
> resources.createActionLink("onActionFromDeleteConfirm", false,
> id).toURI();
>        return new TextStreamResponse("text/html", String.format("< a
> href='%s'>Confirm ", link1));
>    }
>
>   public String onActionFromDeleteConfirm(Long id) {
>        System.out.println("delete confirm");
>        return null;
>    }
> }
>
> html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
>    <title>Start Page</title>
> </head>
> <body>
> <h1>Test Page</h1>
> <t:actionLink t:id="Delete" context="1">Delete</t:actionLink><br/>
> </body>
> </html>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-actionlink-in-another-page-class-tf4730427.html#a13526220
> 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
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.