Adding Applets to a Web Module
See Also
This topic describes how to do the following:
- Add simple applets to a web module
- Add applets that share classes with servlets to a web module
To add a simple applet to a web module
-
Create a directory outside of the web module (that is, not in the web module's
root directory or its subdirectories) for the applet source files.
-
Place your applet classes and client-side helper classes in this source
directory.
-
Package the classes into a JAR file.
- Place the JAR file in a subdirectory
of the web module's root directory other than the WEB-INF subdirectory.
For example,
create a subdirectory named applet and put the JAR file in this directory.
- In the applicable HTML and JSP pages, use the
<applet/> tag with the codebase, archive,
and code attributes to declare the applet and its classes.
To add an applet that shares classes with servlets to a web module:
- Create a directory outside of the web module (that is, not in the web module's
root directory or its subdirectories) for the client-only applet classes,
and put the source code for those classes in the directory.
- Create a separate directory outside of the web module for the shared classes
and put the source code for those classes in the directory.
- Package the directory that has the shared classes into a JAR file and place
it in the WEB-INF/lib directory.
- Package both the client-only classes and the shared classes into a JAR file
and place the JAR file in a subdirectory
of the web module's root directory other than the WEB-INF
subdirectory. For example,
create a subdirectory named applet and place the JAR file in this
directory.
- In the applicable HTML and JSP pages, use the <applet/>
tag with the codebase, archive, and code
attributes to declare the applet and its classes.
- Put the source code for the servlet classes in the WEB-INF/classes
directory.
Legal Notices