Thanks Taha.
That's an option too but it's very similar to what I did. I wanted to avoid 
passing parameters to the component by just using relative paths in the 
component template.

Regards,
Özkan








 >-------- Оригинално писмо --------

 >От: Taha Siddiqi [email protected]

 >Относно: Re: relative page links in components

 >До: "Tapestry users" <[email protected]>

 >Изпратено на: Петък, 2012, Юли 27 13:29:37 EEST



 
> Why not pass page name instead of page instance.
 
> 
 
> In the component
 
> 
 
> @Parameter(required = true)
 
> @Property
 
> private String pageName;
 
> 
 
> and then you can use a pagelink in the component template
 
> 
 
> ...
 
> 
 
> 
 
> regards
 
> Taha
 
> 
 
> On Jul 27, 2012, at 12:37 PM, ZKN __ wrote:
 
> 
 
> > Thanks guys.
 
> > The way I did is define a page parameter in the component like this
 
> > 
 
> > @Parameter(required = true)
 
> >  private SomePage somePage;
 
> > then create a method that builds the url for this page
 
> > public Link getSomePageLink()
 
> >     {
 
> >             return pageRenderLinkSource.createPageRenderLinkWithContext( 
> > somePage.getClass(), new Object[] { ID });
 
> >     }
 
> > and then in the template of the component put this
 
> > go to
 
> > This works but is not ideal because it requires too much code. I have to 
> > define page parameters in the containing pages and then pass to the 
> > component. While if relative paths were possible I could avoid all these 
> > things above.
 
> > 
 
> > 
 
> > Regards,
 
> > 
 
> > Özkan
 
> > 
 
> > 
 
> > 
 
> > 
 
> > 
 
> > 
 
> > 
 
> >> -------- Оригинално писмо --------
 
> > 
 
> >> От: Howard Lewis Ship [email protected]
 
> > 
 
> >> Относно: Re: relative page links in components
 
> > 
 
> >> До: Tapestry users 
 
> > 
 
> >> Изпратено на: Четвъртък, 2012, Юли 26 20:14:49 EEST
 
> > 
 
> > 
 
> > 
 
> > 
 
> >> This will not work, at least, not always. It certainly won't understand 
> >> about page activation context.
 
> > 
 
> >> 
 
> > 
 
> >> Sent from my iPad
 
> > 
 
> >> 
 
> > 
 
> >> On Jul 26, 2012, at 9:37 AM, Alex Kotchnev  wrote:
 
> > 
 
> >> 
 
> > 
 
> >>> Ozkan - just an idea - it seems that you might be able to do something 
> >>> like
 
> > 
 
> >>> this :
 
> > 
 
> >>> 
 
> > 
 
> >>> @Inject
 
> > 
 
> >>> private ComponentResources compResources
 
> > 
 
> >>> 
 
> > 
 
> >>> @Property
 
> > 
 
> >>> String editPath
 
> > 
 
> >>> 
 
> > 
 
> >>> page = compResources.getPage()
 
> > 
 
> >>> editPath =
 
> > 
 
> >>> page.getComponentResources().getBaseResource().forPath("edit").getPath()
 
> > 
 
> >>> 
 
> > 
 
> >>> then, in your component, you'd use something like this :
 
> > 
 
> >>> Edit
 
> > 
 
> >>> 
 
> > 
 
> >>> And of course, this is totally not tested or guaranteed to work - I'm just
 
> > 
 
> >>> looking at the API (
 
> > 
 
> >>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResources.html
 
> > 
 
> >>> ).
 
> > 
 
> >>> 
 
> > 
 
> >>> Cheers,
 
> > 
 
> >>> 
 
> > 
 
> >>> Alex K
 
> > 
 
> >>> 
 
> > 
 
> >>> On Thu, Jul 26, 2012 at 8:12 AM, ZKN __  wrote:
 
> > 
 
> >>> 
 
> > 
 
> >>>> 
 
> > 
 
> >>>> Hi,
 
> > 
 
> >>>> I have a component that's to be included in different pages. Inside the
 
> > 
 
> >>>> component I have page links that need to be relative to the current page.
 
> > 
 
> >>>> Something like this:
 
> > 
 
> >>>> 
 
> > 
 
> >>>> 
 
> > 
 
> >>>> ${message:edit}
 
> > 
 
> >>>> 
 
> > 
 
> >>>> The page link should point to different pages according to the current
 
> > 
 
> >>>> page.
 
> > 
 
> >>>> Is that possible?
 
> > 
 
> >>>> 
 
> > 
 
> >>>> 
 
> > 
 
> >>>> Thanks,
 
> > 
 
> >>>> Özkan
 
> > 
 
> >>>> 
 
> > 
 
> >>>> ---------------------------------------------------------------------
 
> > 
 
> >>>> To unsubscribe, e-mail: [email protected]
 
> > 
 
> >>>> For additional commands, e-mail: [email protected]
 
> > 
 
> >>>> 
 
> > 
 
> >>>> 
 
> > 
 
> >> 
 
> > 
 
> >> ---------------------------------------------------------------------
 
> > 
 
> >> To unsubscribe, e-mail: [email protected]
 
> > 
 
> >> For additional commands, e-mail: [email protected]
 
> > 
 
> > ---------------------------------------------------------------------
 
> > To unsubscribe, e-mail: [email protected]
 
> > For additional commands, e-mail: [email protected]
 
> > 
 
> 
 
> 
 
> ---------------------------------------------------------------------
 
> To unsubscribe, e-mail: [email protected]
 
> For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to