according to your hello world application , is it a java se or ee application if it was se app. so it's a desktop application which you can't put on a website , on the other hand if you were using a java ee you can put it on a website but firstly you need to upload it to a server which will publish it over the internet.
Well, i guess you are actually talking about Java Applets.. What you have read is Java Application.. Java Program has Application and Applet.. The Applet is the java program you use for Web Designing..
what you are talking about can be done using the model view controller paradigm in java ee.. it uses a combination of servlets (controller)/JSP (view)/javabeans (model) to execute java code on a website.
so your the first step is to go to netbeans and start a web project. you will need a server for this (tomcat or glassfish) which is inbuilt with netbeans.. after that, put your java code under the src directory, this is the javabeans part of your code. you will need to make your jsp pages under the web directory, which contains HTML code interspaced with ways to retrieve data from you javabeans file. the servlets (which is just a java file) will contain code to control what happens..