I don't follow your question. It sounds like you are asking how you would stick the code you already have in a JSP. (Which would be poor practice, but the answer would be copy/paste.) I think you are asking something else though.
Also, note I added code tags to your post to make it easier to read.
The server generates an applet code which does not do the same thing each time. This means that my .java file(which contains the applet) is different each time. How to compile this file on the server? I tried this code below but it did not work even though I imported what was needed. I get an error saying that it could not compile.
Where did you see the error message and exactly what did it say.
Joined: Feb 26, 2011
I put tools.jar in my build path in order to use javac and the error(HTTP Status 500) is:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 468 in the jsp file: /CodeGenerator.jsp
com.sun.tools.javac.Main cannot be resolved to a type
466: String javacArguments = new String;
467: javacArguments = "SimApplet.java";