Can anyone help me?

I want to redirect a domain via a JSP in Tomcat.

So if I hit domain1 in the browser there is a 301 to a domain, if I hit domain2 in the browser I get a 301 to a different domain, how is this possible?