This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
iam have written one applet which requests to a servlet while clicking a button in that applet. there is no error in the applet but, the problem is i cannot include that applet in my jsp page. in my workspace there are two folders. one is for storing java files and the other is for storing jsp/html pages. the applet is stored in the first one. how i can give the path in CODE part of APPLET tag
If the compiled applet class and the jsp file exist in the same directory, you can simply identify the applet class name as the value for the code attribute of the applet tag:
Take a look at the Sun Tutorial on writing applets for more details. Theres a section on using the <applet> tag.
It should be noted that the applet tag has been deprecated since HTML4.0 (December 1997) in favor of the object tag. Look at Chapter 2 & 3 of the Java Plugin Guide on Sun's site for more detail on using the object tag (as well as the applet tag). Nonetheless, many people use the applet tag, and it is a bit easier when first learning to write applets. [ January 16, 2005: Message edited by: Mark Vedder ]
Joined: Jan 15, 2005
Thanks for ur advice, but in my case, the applet class and jsp page are stored in different folders. Actually in our application there are two different folders. in one of the folder we stored all the jsp files and the other folder contains all all packages which contains all java files.
Joined: Jan 15, 2005
my problem is not yet solved. if u can provide any help pls help me. thanx in advance
Let's say your JSP or HTML file that is using the applet tag is in <web-root>/files, and your applet (com.foo.applets.MyApplet) is in <web-root>/classes, giving you a directory structure of:
You specify your fully qualified class name in the code attribute, and the directory containing the class in the codebase attribute. Remember that the full name of a class is the package and the class, so you specify the directory that contains the root of the package just as you would in a classpath:
The path to the codebase can be absolute or relative. For the structure listed above, all three of the following are valid. The first example (being a relative path) assumes this applet tag appears in index.jsp, some other file within the files directory, or a file in a directory that is at the same level as the classes directory.
Also, the .class extension on the class name is optional. The following is also valid and works:
I hope that helps [ January 17, 2005: Message edited by: Mark Vedder ]