Get domain with JSP

Hello,
I hope this is a very simple problem to solve (it should be). I am working with JSP for the first time and its going allright. My issue is that I am going to have to work with multiple servers and would like to not have to change the code for the links when I switch servers.

What I need is the TLD (top level domain) of the current page. IE -> www.marcpelland.com/testing/test.html … [url=“http://www.marcpelland.com”]www.marcpelland.com = TLD. I know it is simple with a couple other server-side languages but I am a n00b with JSP.

cheers