Recipe 17.4 Writing HTML Template to Embed a Flash File


You want to write the HTML template text to embed a Flash file in your JSP.


Use the object and embed tags so that the HTML is read correctly by the browsers that support either of these tags.


You may not have the Macromedia Flash application that can automatically generate the HTML which is necessary to embed a Flash file (Recipe 17.4). In this case, write the required HTML template text for embedding a Flash movie inside a JSP.

Example 17-6 shows a JSP with an embedded Flash file (the embedded file has a .swf extension). The same concept applies to this example as to the other recipes: the object tag is for the Internet Explorer Windows browser, which embeds the media file as an ActiveX control, not a Netscape-style plug-in. The embed tag, nested inside the object tag, is designed to embed the Flash file in Netscape and other browsers that support Netscape-style plug-ins.

Example 17-6 is derived from a technical note at

Example 17-6. A JSP contains an embedded file
 <%@ taglib uri="" prefix="c" %> <jsp:useBean id="date" class="java.util.Date" /> <html> <head><title>Flash in a JSP</title></head> <body> <h2>Enjoy the Flash Movie</h2> <OBJECT CLASSID=     "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE=     "      version=6,040,0" width="293" height="423" > <PARAM name="movie" VALUE="coolFlashMov.swf"> <PARAM name="quality" VALUE="high"> <PARAM name="bgcolor" VALUE="#FFFFFF"> <EMBED src="coolFlashMov.swf" quality="high" width="293" height="423"     bgcolor="#FFFFFF" type="application/x-shockwave-flash" PLUGINSPAGE=    "" > </EMBED> </OBJECT> <br /><c:out value="${date}"/> </body> </html> 

Both the embed and object tags are designed to prompt the end user to download the required version of the Flash plug-in or ActiveX control if they do not already have it installed.

See Also

Macromedia technical notes page:; an article about alternative techniques to using the embed tag:

Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: