Second question

When you say online do you mean as in part of a web page or merely as an internet enabled application?
If you are going for the web based then I would stick with a server-side scripting language(JSP, PHP, ASP, etc) and a database(mySQL, MS SQL2000, etc).
If, however, you are writing your own chat application that will not run (initially) through the web browser, then I would highly recomend using XML. Here is the idea. If you write a server/client pair of applications, you can then pass all communications in XML format. All communications has to be flagged somehow, whether it is a request to log on, a text message, a private message, whatever. XML can help you clarify your messages that are going back in forth between your client and server, as well as create later versions of your chat program that are interoperable with the original.
What you will want to do is create an xml format that all of your message will follow. SA very simple format for communications is that all communications will be enclosed in <mychat> tags. The perhaps you will want <messagetype> tags and <message> tags inside of that. Perhaps you want a <recipient> tag inside your message tag as well as a <messagebody> tag. See how this is going?
My advice would be to write a small chat program with a simple xml vocabulary. This should get you used to working with an XML parser of some sort in Java. After using a parser in Java I found that I had a pretty good grasp on the basics and was able to move on to XSL, MSXML DOM, and several other parsers.
Another good project is to try and create your own visual representation of an XML page. perhaps you want to recreate a tree view similar to something you have seen somewhere before? Write or steal an xml file from somewhere and then try to write a program to parse through the file creating a tree view. Then take it a step further, make it editable and saveable. By the time you have completed that you will be bald (hair pulling) but you will have a very good grasp on the concepts behind XML and XML parsers.
Just remember xml is a data description language, not necessarally a data storage or content description language.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation