You need to learn JSP (Java Server Pages) to create dynamic HTML pages using Java.
You'd need Tomcat and Apache installed to run .jsp files locally. (Both are free, and other alternatives are present too.)
A good place to start with it would be here:
http://www.jsptut.com/ (The tutorial there is simple enough to give you an idea of JSP on the whole.)
Later on you can refer official documentations or purchase books and learn more.