Use Link#toAbsoluteURI() or Link#toURI() depending on your need( I think here 
toAbsoluteURI() is more appropriate)


On Dec 18, 2013, at 8:32 PM, Chris Mylonas wrote:

> Thanks Taha - I was looking at the Link Component FAQ earlier scratching my
> head.  It spits out the text for the link, not a html link.
> 
> So I tried this:
>            Link link = linkSource.createPageRenderLink(IPAddress.class);
>            if (ni != null) {
>                form.recordError(commonNameField, "The ip address you
> entered is public and in use - please try again or search for it <a
> href=\"" + link + "\">HERE</a>" );
>            }
> 
> and that just spits out text too.
> 
> 
> 
> Given it's 2am, I'm going to bed.  Try again tomorrow with a fresh head.
> Cheers,
> Chris
> 
> 
> 
> 
> On Wed, Dec 18, 2013 at 4:25 PM, Taha Hafeez Siddiqi <
> tawus.tapes...@gmail.com> wrote:
> 
>> You can use
>> 
>> 
>> http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html#createPageRenderLink(java.lang.Class)
>> 
>> 
>> @Inject
>> private PageRenderLinkSource linkSource
>> 
>> form.recordError(someField, "my link is " +
>> linkSource.createPageRenderLink(MyPage.class));
>> 
>> there are other variants of createPageRenderLink which can take context
>> parameters.
>> 
>> regards
>> Taha
>> 
>> On 18-Dec-2013, at 8:18 AM, Chris Mylonas <ch...@opencsta.org> wrote:
>> 
>>> Hi Tapestry Users,
>>> 
>>> What is the best way to include a link to a page from the java class?
>>> 
>>> I have a form, returning an error that states: "The ip address you
>> entered
>>> is public and in use - please try again or search for it to see it's
>>> current use"
>>> 
>>> I would like to put a link in that error message to the search page.
>>> 
>>> It's just a standard form.recordErrors
>>> 
>>>               form.recordError(commonNameField, "The ip address you
>>> entered is public and in use - please try again or search (PUT LINK HERE
>> TO
>>> SEARCH PAGE) for it to see it's current use");
>>> 
>>> Cheers
>>> Chris
>> 
>> 

Reply via email to