It looks like what you're trying to do is make a program that displays an HTML page, then submits data to a java program when you click "submit." Java and HTML are two completely separate, different things. Getting them to talk to each other is hard. To do that, you're probably going to need to use some kind of framework designed specifically to help HTML-type pages talk to Java programs, like Spring or Struts, or you could use just plain servlets in a Java Web Application.
The basic structure you probably need looks like this:
You have a Java Web Application project. You also have a server, which is just a piece of software which you hand your project to, and once it has your project, it runs it for you and handles requests made to the pages you set up in your project.
Java Web Applications have a folder called "Web Pages" that contains HTML and JSP files. Your project will have a folder that contains java source code files, which includes servlets. The source code folder can be divided into "packages", which are just collections of java classes that you've decided to put in their own folder. Servlets are just java classes that accept data and do things with it. In order to use them though, they have to be paired up with a name so that your pages on the front end know where to send their data. That pairing is done in another file that all Java Web Applications have, it's called "web.xml", and a typical pairing of a servlet to a name will look like this:
Most of the time, the servlet-name will be something like "heightSubmit", the url-pattern will be something like "/heightSubmit", and the servlet-class would be something like "servlets.heightSubmit". What I'm getting at is they're usually all pretty much the same, but I made them different in this case to show how they relate to other things in the project. The "servlet-class" tells the project how to find your servlet by telling it exactly where to find the class file. The servlet-name is what ties the "servlet" to the "servlet-mapping", and the "url-pattern" is what you're going to use to reference the servlet when you actually have some data to send to it.
An HTML file is a document that tells a browser "Hey, this is what goes on this page." A JSP file does the same thing, but instead of just being a static document describing stuff, it's actually a java class file that prints stuff out directly. When you edit it, it looks like you're editing an HTML file, but it's actually different. JSP files are allowed to have what are called 'forms', and they look like this:
That basically says 'Hey, I'm going to put a box in this page, and when the user puts things in it, I want you to remember what's in it and make it so whatever servlet is located at "heightSubmit" can look at it too. When you submit this page, the server will say "Someone wants me to send this data to the servlet that's mapped to "/submitTheHeight"... I found a <servletMapping> that's mapped to "/submitTheHeight". The servlet-name is "heightSubmit", so I need to find the <servlet> that also has a servlet-name of "heightSubmit"... I have a <servlet> with a servlet-name of "heightSubmit", and for that <servlet>, the
servlet-class is "servlets.submitHeight", so I'll pack this data up in a special way that the user doesn't need to worry about understanding and send it over to the java class file located at "servlets.submitHeight".
Explaining the rest would require that you have some basic understanding of java, and I'm not actually sure what level you're at, so I'll throw the rest of it down here, but if this next part sounds like gibberish, do the tutorials down below and come back to this later:
Your servlet will receive the data in the form of an "HttpServletRequest" object, which I usually just call "request". You're also given an "HttpServletResponse" object, that I usually call "response", that you can use to send stuff back to the browser when you're done doing stuff with the request. You can call getParameter(String parameterName) on that request object to pull out the stuff that the user typed in on the page. Note though, that getParameter only ever pulls things out as Strings; if you want it as a number you'll have to convert it. So to get the data out that they put into the input box that had the name "height" and store it as a String object so you can do other stuff with it, you would do this:
Then at the end of the servlet you can use the response object to do some other things, like send the user to a new page by doing this: response.sendRedirect("theNameOfANewPageToGoTo");
So at a minimum you're going to need a Java Web Application project containing:
- Some Java class files which can be used as servlets,
- Some JSP pages
- A web.xml file that tells the JSP pages where to find the servlets
And you need a server program that you can hand your project to so it can run.
And also, it looks like you're not using an Integrated Development Environment to do this? If you're not, I'd really recommend writing your code using an IDE. You*can* compile java from the command line like that, but it's so much easier to do with a program that's specifically designed to write, compile, and run code. If you're trying to do web stuff, I'd really recommend using the NetBeans IDE, which you can download here: https://netbeans.org/downloads/
Get the one with everything. It comes with Tomcat 8, which is a server that you can use, and it's built into the IDE so you don't have to worry about configuring too much of that yourself. Good luck!