We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


how to embed flash object into jsp page

AceAdmin asked
Medium Priority
Last Modified: 2012-06-21
I'm having a problem with flash and jsp pages. I am converting from one html web page (where the creator has used java script to create a flash object on the page) into a jsp page. To be honest im not really sure how to create a flash object in a jsp page. I have seen the use of <object> tag when i have searched this forum but in not sure how to use some of the values that I have in the javascript. to make it clearer here is the javascript that creates the flash object in the HTML page.

      <script type="text/javascript" src="./javascript/flashobject.js"></script>
        <script type="text/javascript">
        // <![CDATA[
        var fo = new FlashObject("./slideshow/slideshow.swf", "header-slideshow", 526, 135, 6, "#d7dee8");
        fo.addVariable("xmldir", "./slideshow/");
        fo.addVariable("imagedir", "./images/");
        fo.addVariable("xmlFile", "header.xml");
        fo.addVariable("XSize", "526");
        fo.addVariable("YSize", "135");
        fo.addVariable("picPause", "5");
        fo.addParam("quality", "high");
        fo.addParam("scale", "exactfit");
        fo.addParam("pluginspage", "http://www.macromedia.com/go/getflashplayer");
        fo.addParam("type", "application/x-shockwave-flash");
        // ]]>

I can see the addParam would be sorted using the

<param name="" value=""> tag I think but i dont know a tag for the variable.

Watch Question

Top Expert 2006

You can treat the flash code for the jsp exactly as you would for html. The extra benefit for using JSP is that you can dynamically assign parameters on the server using scriptlets as in this example where the quality level is set from a value hardcoded earlier.

<% String flashQuality = "high" ; %>

        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         width="787" height="346">
            <param name="movie" value="home_page.swf">
            <param name="loop" value="false">
            <param name="menu" value="false">
            <param name="quality" value="<%= flashQuality %>">
            <param name="bgcolor" value="#000000">
            <embed src="home_page.swf" loop="false" menu="false" quality="high" bgcolor="#000000"
             width="787" height="346" type="application/x-shockwave-flash"



what would i use for
fo.addVariable("YSize", "135");
I dont know what the tagname is.
would it be

<variable name ="" value="">
Top Expert 2006
It depends on what you are doing. In this case I would guess that it is the height variable so you would do somehting like this

<% String flashHeight = "346" ; %>

        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         width="787" height="<%= flashHeight  %>">...

You are aware that you could just leave the javascript as it is. Javascript will run in jsp just as well as in HTML.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


cheers it did work in the java script version after all.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.