posted 14 years ago
Welcome to the JavaRanch!
To permit your website to be findable by name, you have to get an entry in the "Internet phone book", which is Domain Name Services. That means that you have to purchase rights to the domain name "mywouldbesite.com" from one of the domain name registrars such as Verisign or GoDaddy. You can also buy the name though your ISP in many cases. That will give you the rights for "mywouldbesite.com" for a specified number of years, after which you'd have to renew the name, since it's really only rented, rather than purchased. And, of course, you have to have a domain name that no one else holds the registration on.
Once you've done that, you have to get the actual host IP address bound to a host name in that domain. Typically, that hostname would be "www" for the web host, but it doesn't have to be. This binding is done in the nameserver(s) that are registered with your domain name. Often your ISP will provide that service, although there may be a small fee.
Next, to get the port number off the URL, you'll have to do some work yourself. When a user enters a URL that doesn't have an explicit port number on it, and the protocol part of that URL is "http:", the client will assume port 80. So you'll need to make your webapp respond on port 80. You can do that by either changing the ports used by Tomcat (from 8080 to 80) or by proxying through another server, such as apache httpd.
Finally, to get the web application context name out of the URL, you'll either need to install it under the root context ("/") or, if you're using a proxying system, use the proxy rules to direct from the raw URL to the tomcat context.
I prefer the proxying approach, since Tomcat can only have one root context, but Apache can easily make multiple webapps each look they're at a root level. Plus it allows me to add non-J2EE resources to the overall webserver picture if I like.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.