First thing...you must have very good idea about Java Web Application Architecuture. How you can configure and use servlets, web.xml, web-app directory structure etc. Good serverlet Container is Apache Tomcat. If you don't know these, I think it is useless even if you get ready made code
Resources, Of course java.sun.com
Regards