Hi,

I see. It's actually easier than you'd think. Here's what you do:

Class:

  @Inject
  private ComponentResources componentResources;

  public String getLink() {
return componentResources.createPageLink("targetpagehere", true").toURI();
  }

Template:

  <a href="${link}">text for link</a>

See? It's easy. :)

But since you're linking to a page, why not just use the PageLink component? That's even easier.

  <t:pagelink t:page="targetpagehere">text for link</t:pagelink>

You can see all the components here:
http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html

Hope this helps.

-Filip

Konstantin skrev:
I think I'm missing concept behind renderObject component.
The original idea was to render Link or just some text basing on other page
properties and actual object to be rendered should be returned by public
Object getMyDynaObject().
So I need to get <href ...> in page markup for link, but instead I get
"targetPageHere/11".
Is it possible to do without creating custom component ?


Filip S. Adamsen-2 wrote:
Hi,

Tapestry does what you ask it to do - returns a (relative) URI for the link. (Check out the Javadocs/source for AbstractLink to see this.)

I suspect that calling toAbsoluteURI() on the link will give you what you want. Oh, and you won't need RenderObject for that - you can just do an expansion ${myDynaObject} in that case.

-Filip

Konstantin skrev:
in tml:

<t:renderobject object="myDynaObject"/>

in java:

    @Inject
    private ComponentResources componentResources;

    public Object getMyDynaObject() {
        Link testLink;
        testLink = componentResources.createPageLink("targetPageHere",
true,
"11");
        return testLink;
    }

Renders text "targetPageHere/11" instead of actual link. What am I doing
wrong here ?

---------------------------------------------------------------------
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