1

As this question, I'm trying to put a link to an external site.
The problem is that using:

<a href="stackoverflow.com">Go to this site!</a>

I think that this tag should not be controlled by JSF (not?) and generate a direct HTML, but anyway JSF modifies and produces a relative link (http://localhost/webapp/stackoverflow.com), as if it was an outcome. It also does even if the url is begins with www.. So, the question is:

I'm forced in JSF to put protocol, even with the <a> tag?

Community
  • 1
  • 1
lucasvc
  • 767
  • 1
  • 11
  • 35

1 Answers1

3

This is not specific to JSF. JSF is just a HTML code generator. You would have exactly the same problem when using plain HTML. All relative URLs in the HTML document are always relative to the base URL of the current request (as you see in browser address bar or have specified in HTML <base> tag).

You need to explicitly specify the scheme to make it an absolute URL instead.

<a href="http://stackoverflow.com">Go to this site!</a>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Oks. Thanks! I didn't test it with plain-old-HTML. BTW, if you could review [this](http://stackoverflow.com/q/10280808/1099452) I would appreciate :) – lucasvc Apr 23 '12 at 12:45