2

I'm trying to create a link (href) that open itself in a new page. Should be "simple".

That's the focus code:

if (propertybox.getValue(CandidatoLink.LINK) != null) {
    Anchor anchor = new Anchor(propertybox.getValue(CandidatoLink.LINK),
            propertybox.getValue(CandidatoLink.LINK));
    anchor.setTarget("_blank");
    return anchor;
}

This is to get the link from the database, like "www.google.com":

propertybox.getValue(CandidatoLink.LINK));

This is to get the link opening in a new tab of the browser:

anchor.setTarget("_blank");

It works all just fine: I can get the link opened in a new tab. The only problem is that the system think that's an intern page of the website and sees it as a Route! That's the problem. It will open a new tab with this link: http://localhost:8080/www.google.com

I can't remove the first part (http://localhost:8080/). Can someone help me?

I use Java 11.0.15, Vaadin 14 (Maven/Spring Boot) and my IDE is Eclipse 2022-06 (4.24.0).

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

0 Answers0