I dont know what technologies you apply in your application (Jsp/servlet or both....)
For that I just can only help you some:
Users have to register first.
Create a page that for users to register that including an option to send/receive messages... (can be a HTML page as basic) and submit informations to a
Servlet (RegisterServlet) that store information to Database
After loging in
Create a login page and submit info to a LoginServlet to check username/password...If login succeed, store user's information to Session(for later use) and redirect or forward to a Servlet(UserMessageListServlet) that shows a list of messages.
In UserMessageListServlet to could get username from the Session that you set before to load all message of that user....
That all I can tell you for shortly, if you need more help,just email or post your problem here
Nice beginning