dev@javaserverfaces.java.net

h:link

From: Michael Müller <michael.mueller_at_mueller-bruehl.de>
Date: Fri, 13 Apr 2012 18:01:24 +0200

h:link renders an "a" element and if disabled is true, a "span" element.

Ok, I wanted output internal as well as external links. Here's what I did:

<h:link outcome="#{sessionTools.encodeResourceURL(reviewLink.url)}" value="#{reviewLink.description}"
         target="#{reviewLink.url.toLowerCase().startsWith('http') ? '_blank' : '_self'}"/>

For url="/review.xhtml?reviewId=5 <view-source:http://localhost:8080/Books/review.xhtml?reviewId=5>" I'll get a link as expected:
<a href="/Books/review.xhtml?reviewId=5 <view-source:http://localhost:8080/Books/review.xhtml?reviewId=5>"target="_self">it-rezension.de</a>


But using an external link like "http://www.linux-magazin.de/Heft-Abo/Ausgaben/2010/10/Tux-liest <view-source:http://www.linux-magazin.de/Heft-Abo/Ausgaben/2010/10/Tux-liest>" JSF recognizes this is not a link to the own app. I supposed it will render this link as is but I got a "span":

<span target="_blank">Extern</span>

Is this by intention or is this a bug?

-- 
Herzliche Grüße - Best Regards,
Michael Müller