You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by akshay <ak...@gmail.com> on 2015/01/24 16:10:10 UTC
Redirecting to a Page with context
Hi,
Can anyone please suggest me a way of redirecting/rendering a page with
context from my current page.
This what I have been doing:-
@Inject
private ComponentSource componentSource;
Object onActivate(){
return componentResources.getPage(getPageName());
//This works fine till the time I have valid logical page name such as
"/project/index". It fails when I add a context to it such as
project/details/10871(which is because I believe it expects only the
logical page name(existing in the package) without the context.
}
I am looking for a tapestry solution for this.Has anyone tried
redirecting/rendering to the page with context.
--
Best Regards!!
Akshay
Re: Redirecting to a Page with context
Posted by Geoff Callender <ge...@gmail.com>.
This will probably help:
T5.4: http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/returntypes1
T5.3: http://jumpstart.doublenegative.com.au/jumpstart/examples/navigation/returntypes1
Cheers,
Geoff
On 25 Jan 2015, at 4:43 am, Chris Poulsen <ma...@nesluop.dk> wrote:
> return the link from the handler and tapestry will redirect/render it
>
> On Sat, Jan 24, 2015 at 5:05 PM, akshay <ak...@gmail.com> wrote:
>
>> Hi Chris,
>>
>> Well I have already tried using PageRenderLinkSource for getting the
>> link"project/details/10871".
>> Once I get the link I transfrom it to absolute URI and then java.net.URL to
>> render the specific page( which is not tapestry way).
>>
>> The PageRenderLinkSource gives you the link, but we need something to
>> render it(if am not mistaken).
>>
>> I cannot use @InjectPage, as my pages to be rendered are decided
>> dynamically.
>>
>> Best Regards
>> Akshay
>>
>> On Sat, Jan 24, 2015 at 4:15 PM, Chris Poulsen <ma...@nesluop.dk>
>> wrote:
>>
>>> PageRenderLinkSource or @InjectPage / set fields / return page / rely on
>>> onPassivate
>>>
>>> On Sat, Jan 24, 2015 at 4:10 PM, akshay <ak...@gmail.com>
>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can anyone please suggest me a way of redirecting/rendering a page with
>>>> context from my current page.
>>>>
>>>> This what I have been doing:-
>>>>
>>>> @Inject
>>>> private ComponentSource componentSource;
>>>>
>>>> Object onActivate(){
>>>> return componentResources.getPage(getPageName());
>>>> //This works fine till the time I have valid logical page name such as
>>>> "/project/index". It fails when I add a context to it such as
>>>> project/details/10871(which is because I believe it expects only the
>>>> logical page name(existing in the package) without the context.
>>>> }
>>>>
>>>> I am looking for a tapestry solution for this.Has anyone tried
>>>> redirecting/rendering to the page with context.
>>>>
>>>> --
>>>> Best Regards!!
>>>> Akshay
>>>>
>>>
>>
>>
>>
>> --
>> Cheers!!
>> Akshay
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Redirecting to a Page with context
Posted by Chris Poulsen <ma...@nesluop.dk>.
return the link from the handler and tapestry will redirect/render it
On Sat, Jan 24, 2015 at 5:05 PM, akshay <ak...@gmail.com> wrote:
> Hi Chris,
>
> Well I have already tried using PageRenderLinkSource for getting the
> link"project/details/10871".
> Once I get the link I transfrom it to absolute URI and then java.net.URL to
> render the specific page( which is not tapestry way).
>
> The PageRenderLinkSource gives you the link, but we need something to
> render it(if am not mistaken).
>
> I cannot use @InjectPage, as my pages to be rendered are decided
> dynamically.
>
> Best Regards
> Akshay
>
> On Sat, Jan 24, 2015 at 4:15 PM, Chris Poulsen <ma...@nesluop.dk>
> wrote:
>
> > PageRenderLinkSource or @InjectPage / set fields / return page / rely on
> > onPassivate
> >
> > On Sat, Jan 24, 2015 at 4:10 PM, akshay <ak...@gmail.com>
> wrote:
> >
> > > Hi,
> > >
> > > Can anyone please suggest me a way of redirecting/rendering a page with
> > > context from my current page.
> > >
> > > This what I have been doing:-
> > >
> > > @Inject
> > > private ComponentSource componentSource;
> > >
> > > Object onActivate(){
> > > return componentResources.getPage(getPageName());
> > > //This works fine till the time I have valid logical page name such as
> > > "/project/index". It fails when I add a context to it such as
> > > project/details/10871(which is because I believe it expects only the
> > > logical page name(existing in the package) without the context.
> > > }
> > >
> > > I am looking for a tapestry solution for this.Has anyone tried
> > > redirecting/rendering to the page with context.
> > >
> > > --
> > > Best Regards!!
> > > Akshay
> > >
> >
>
>
>
> --
> Cheers!!
> Akshay
>
Re: Redirecting to a Page with context
Posted by akshay <ak...@gmail.com>.
Hi Chris,
Well I have already tried using PageRenderLinkSource for getting the
link"project/details/10871".
Once I get the link I transfrom it to absolute URI and then java.net.URL to
render the specific page( which is not tapestry way).
The PageRenderLinkSource gives you the link, but we need something to
render it(if am not mistaken).
I cannot use @InjectPage, as my pages to be rendered are decided
dynamically.
Best Regards
Akshay
On Sat, Jan 24, 2015 at 4:15 PM, Chris Poulsen <ma...@nesluop.dk>
wrote:
> PageRenderLinkSource or @InjectPage / set fields / return page / rely on
> onPassivate
>
> On Sat, Jan 24, 2015 at 4:10 PM, akshay <ak...@gmail.com> wrote:
>
> > Hi,
> >
> > Can anyone please suggest me a way of redirecting/rendering a page with
> > context from my current page.
> >
> > This what I have been doing:-
> >
> > @Inject
> > private ComponentSource componentSource;
> >
> > Object onActivate(){
> > return componentResources.getPage(getPageName());
> > //This works fine till the time I have valid logical page name such as
> > "/project/index". It fails when I add a context to it such as
> > project/details/10871(which is because I believe it expects only the
> > logical page name(existing in the package) without the context.
> > }
> >
> > I am looking for a tapestry solution for this.Has anyone tried
> > redirecting/rendering to the page with context.
> >
> > --
> > Best Regards!!
> > Akshay
> >
>
--
Cheers!!
Akshay
Re: Redirecting to a Page with context
Posted by Chris Poulsen <ma...@nesluop.dk>.
PageRenderLinkSource or @InjectPage / set fields / return page / rely on
onPassivate
On Sat, Jan 24, 2015 at 4:10 PM, akshay <ak...@gmail.com> wrote:
> Hi,
>
> Can anyone please suggest me a way of redirecting/rendering a page with
> context from my current page.
>
> This what I have been doing:-
>
> @Inject
> private ComponentSource componentSource;
>
> Object onActivate(){
> return componentResources.getPage(getPageName());
> //This works fine till the time I have valid logical page name such as
> "/project/index". It fails when I add a context to it such as
> project/details/10871(which is because I believe it expects only the
> logical page name(existing in the package) without the context.
> }
>
> I am looking for a tapestry solution for this.Has anyone tried
> redirecting/rendering to the page with context.
>
> --
> Best Regards!!
> Akshay
>
Re: Redirecting to a Page with context
Posted by akshay <ak...@gmail.com>.
Hi Thiago,
Thanks for your response.
I already solved the issue using PageRenderLinkSource.
Regards
Akshay
On Mon, Jan 26, 2015 at 1:26 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:
> On Sat, 24 Jan 2015 13:10:10 -0200, akshay <ak...@gmail.com>
> wrote:
>
> Hi,
>>
>
> Hi!
>
> Can anyone please suggest me a way of redirecting/rendering a page with
>> context from my current page.
>>
>
> I'm sorry, I'm not following you. Redirecting and rendering a page are
> completely different actions with completely different outcomes.
>
>
>> This what I have been doing:-
>>
>> @Inject
>> private ComponentSource componentSource;
>>
>> Object onActivate(){
>> return componentResources.getPage(getPageName());
>> //This works fine till the time I have valid logical page name such as
>> "/project/index". It fails when I add a context to it such as
>> project/details/10871(which is because I believe it expects only the
>> logical page name(existing in the package) without the context.
>> }
>>
>
> The code above is incorrect and would never work with a context. Anyway,
> you seem to be trying to build the URL yourself. Don't do that. Let
> Tapestry do that for you.
>
> You can do way simpler:
>
> @InjectPage
> private YourTargetPage yourTargetPage;
>
> Object onActivate() {
> yourTargetPage.setXXX(...);
> yourTargetPage.setYYY(...);
> return yourTargetPage;
> }
>
> This supposes YourTargetPage has correctly implemented onActivate() and
> onPassivate().
>
> You could also @Inject PageRenderLinkSource and use its methods.
>
> Anyway, check http://tapestry.apache.org/page-navigation.html. It has
> everything you need to know about going from one page to another in
> Tapestry.
>
> --
> 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
>
>
--
Cheers!!
Akshay
Re: Redirecting to a Page with context
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 24 Jan 2015 13:10:10 -0200, akshay <ak...@gmail.com>
wrote:
> Hi,
Hi!
> Can anyone please suggest me a way of redirecting/rendering a page with
> context from my current page.
I'm sorry, I'm not following you. Redirecting and rendering a page are
completely different actions with completely different outcomes.
>
> This what I have been doing:-
>
> @Inject
> private ComponentSource componentSource;
>
> Object onActivate(){
> return componentResources.getPage(getPageName());
> //This works fine till the time I have valid logical page name such as
> "/project/index". It fails when I add a context to it such as
> project/details/10871(which is because I believe it expects only the
> logical page name(existing in the package) without the context.
> }
The code above is incorrect and would never work with a context. Anyway,
you seem to be trying to build the URL yourself. Don't do that. Let
Tapestry do that for you.
You can do way simpler:
@InjectPage
private YourTargetPage yourTargetPage;
Object onActivate() {
yourTargetPage.setXXX(...);
yourTargetPage.setYYY(...);
return yourTargetPage;
}
This supposes YourTargetPage has correctly implemented onActivate() and
onPassivate().
You could also @Inject PageRenderLinkSource and use its methods.
Anyway, check http://tapestry.apache.org/page-navigation.html. It has
everything you need to know about going from one page to another in
Tapestry.
--
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