Hi I know the language of HTML, CSS, and Java pretty well, but I have absolutely no idea on how to connect the java backend to frontend. I'm a complete amateur when it comes to programming, I just know the basics of each of these languages pretty well. I have my HTML and CSS coded to take in input, and I have all the calculations written in Java, so I have the functions of what I want to do all ready. I just don't know how to pass the user's input from the HTML, to the calculations in Java. I just run my Java code using scanner as the user input, but I want to integrate all my codes to make it a real website, and I think I'm going to need more than scanner for a user to input something on a website. I researched this topic multiple times, and I found information about serverlets and IntelliJ, but the information was confusing to me because again, I am a complete amateur in computer science (other than knowing these languages). Some also said the best way was to convert my java code to javascript, but I'm not sure if that's the best way. Any suggestions/information on what to do? Here's some of my java code (this part takes in user input, searches for the numbers before the last slash, then adds it to double firsum). Thanks!
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double firsum = 0;
while (sc.hasNext()) {
String ip = sc.nextLine();
int def = ip.lastIndexOf("/");
double firnum = 0;
for (int i = 1; i < 7; i++) {
if (ip.charAt(def-i) != '\t') {
firnum = Double.parseDouble(ip.substring(def - i, def));
out.println(firnum);
}
}
firsum += firnum;
}
}