It helps if you stop thinking about what you see in the browser, like menu bars and so on. What you actually want to do is to send the same HTTP requests to the web application that a browser would send. Also you have to handle the responses you get from the web application in the same way that a browser would.
So that means you have to find out what requests your browser is sending, for a start. If you're using Firefox then the HttpFox plugin will help you with that, and I expect other browsers have similar tools. Then you have to write Java code which sends those requests. If you're logging in then most likely the web application will send you a cookie, which you'll have to send back with subsequent requests to maintain the session. I have seen other people suggest that HtmlUnit is a useful tool for managing this process, but I haven't used it myself.
yeah, but ... what would PIE do? Especially concerning this tiny ad: