this has nothing to do with servlets. HTML 4.01 Transitional uses the URI syntax as described in RFC 2396 for the action attribute in the form tag. The thing you used first ("/login") is called an "absolute-path reference" there, and it means that the absolute URI you requested is the netpath/login. But what you really wanted is netpath/your-application/login.
The way it worked for you is ok, too. That's a "relative-path reference" ("login").
So the options are something like: action="http://localhost:8080/hf/login" action="/hf/login" action="login"