[an error occurred while processing this directive]

Embed flash file in jsp page

                         

In this example, we will see how to embed a flash file in jsp page. In the example given below we have used HTML tag in jsp code to embed flash file.

<OBJECT> in HTML  is used to insert an object in html document and also provide all the information to run this object.

<PARAM> in HTML  is used to pass the parameters that are required to implement the object.

<EMBED> in HTML is provide easiest and most supportive way to embed video, sound, flash files in the web page. We can add Real Media, Quick Time movies, Windows Media, Flash animations in web page through <EMBED> tag.

This is example of jsp code to embed a flash animation file named 'pic.swf' in web page. Before run this example create a new directory named "user" in the tomcat-6.0.16/webapps and paste WEB-INF directory in same directory.

add_flash_to_jsp.jsp

<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html; 
 charset=Big5">
<TITLE>Embed flash file in jsp page.</TITLE>
</HEAD>
<BODY bgcolor="#ffffcc">
<p><% out.println("This is embedded flash file 
                   in jsp page."); %></p>
<div style="position: relative; width: 400px; height: 
 300px; overflow:hidden">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
      codebase="http://download.macromedia.com/pub/shockwave/cabs
                /flash/swflash.cab#version=6,0,29,0" 
	   width="225" height="113">
      <param name="quality" value="high">
      <embed src="pic.swf" quality="high" pluginspage=
       "http://www.macromedia.com/go/getflashplayer" 
	     type="application/x-shockwave-flash" width="225" 
                   height="113">
      </embed>
    </object>
</div>
</BODY>
</HTML>

Save this code as a .jsp file named "add_flash_to_jsp.jsp" in the directory Tomcat-6.0.16/webapps/user/ and you can run this jsp page with following url in address bar of the browser "http://localhost:8080/user/add_flash_to_jsp.jsp"

Download Source File

                         

[an error occurred while processing this directive]