Redirecting to a Page with context

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirecting to a Page with context

Akshay
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
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

Chris Poulsen
PageRenderLinkSource or @InjectPage / set fields / return page / rely on
onPassivate

On Sat, Jan 24, 2015 at 4:10 PM, akshay <[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

Akshay
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 <[hidden email]>
wrote:

> PageRenderLinkSource or @InjectPage / set fields / return page / rely on
> onPassivate
>
> On Sat, Jan 24, 2015 at 4:10 PM, akshay <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

Chris Poulsen
return the link from the handler and tapestry will redirect/render it

On Sat, Jan 24, 2015 at 5:05 PM, akshay <[hidden email]> 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 <[hidden email]>
> wrote:
>
> > PageRenderLinkSource or @InjectPage / set fields / return page / rely on
> > onPassivate
> >
> > On Sat, Jan 24, 2015 at 4:10 PM, akshay <[hidden email]>
> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

JumpStart
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 <[hidden email]> wrote:

> return the link from the handler and tapestry will redirect/render it
>
> On Sat, Jan 24, 2015 at 5:05 PM, akshay <[hidden email]> 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 <[hidden email]>
>> wrote:
>>
>>> PageRenderLinkSource or @InjectPage / set fields / return page / rely on
>>> onPassivate
>>>
>>> On Sat, Jan 24, 2015 at 4:10 PM, akshay <[hidden email]>
>> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

Thiago H de Paula Figueiredo
In reply to this post by Akshay
On Sat, 24 Jan 2015 13:10:10 -0200, akshay <[hidden email]>  
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to a Page with context

Akshay
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 <
[hidden email]> wrote:

> On Sat, 24 Jan 2015 13:10:10 -0200, akshay <[hidden email]>
> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Cheers!!
Akshay