About the Author
Bruce W. Perry is an independent software developer and writer. Since 1996, he has developed web applications and databases for various non-profits, design and marketing firms, ad agencies, and digital-music specialists. Before working in the web field, Perry remained tethered to his portable and desktop Macs while writing environmental law books and newsletters. When not hacking or writing, he loves cycling and climbing mountains in the U.S. and Switzerland. He lives in the Newburyport, Massachusetts area with his wife Stacy LeBaron and daughter Rachel.
Excerpt. © Reprinted by permission. All rights reserved.
CHAPTER 17 - Embedding Multimedia in JSPs
Most web sites include some type of multimedia and interactive programs, such as digital videos, digital audio files, Macromedia Flash movies, and Java applets. Therefore, Java web sites often integrate this type of content with servlets and JavaServer Pages (JSPs). This chapter explains the basics of embedding multimedia in Java web components. This process involves including the object and embed tags in your components HTML output.
A JSP is the preferred choice for combining multimedia with dynamic content, because you can make the tags that you use to embed the multimedia a part of the JSPs HTML template text. However, Recipe 17.5 also shows how to include multimedia as part of a servlets output.
If the page containing the multimedia content does not have to include any other type of dynamic output, just use a static HTML page instead of executing JSPs and servlets. A static page typically requires fewer server resources to respond to HTML page requests.
17.1 Embedding an Applet in a JSP
You want to use the jsp:plugin standard action to execute a Java applet with the Java Plug-in software.
Use the jsp:plugin action positioned in the area of a JSP where you want the applet
The JSP specification provides a standard action, jsp:plugin, which produces the object and embed tags that are designed to allow browsers to load a Java applet. The action will run the applet using Sun Microsystemss Java Plug-in or initiate the download of the Plug-in if the user has not yet installed the Plug-in.
The Java Plug-in is designed to execute an applet using Sun Microsystemss Java 2 Runtime Environment, rather than any Java runtime provided by the browser. The installation of the Java JRE or Software Development Kit automatically installs the Java Plug-in.
Use nested jsp:param elements to provide the applet with any necessary parameter and value pairs. The jsp:param elements must be nested within a single jsp:params element.