Berchev
Berchev

Reputation: 87

h:outputLink to external URL

I have the following code:

<p>
    <b>Website: </b>
    <h:outputLink value="#{HOTEL.hotel.website}" target="_blank">
        <h:outputText value="#{HOTEL.hotel.website}" />
    </h:outputLink>
</p>

I want to make just a simple link to an external URL that I hold in my DB. The problem is that it is taking correctly the URL but before the URL it puts the main URL of the website, see below:

http://localhost:8080/Hotels/faces/www.chernomorebg.com

In the database it is only

www.chernomorebg.com

I have tried with just a normal

<a href=""></a> 

tag but again with no success. The I am using Tomcat 8 and PrimeFaces 5.1.

Upvotes: 0

Views: 2776

Answers (1)

fzzfzzfzz
fzzfzzfzz

Reputation: 1248

You left off the leading http:// in that url, so the browser assumes it's a relative url (a link to content elsewhere on the current site). Store the URL as http://www.chernomorebg.com in the database to solve this.

This page has more information on this subject.

Upvotes: 1

Related Questions