• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I animate JPEGs in JSP?

 
Mike London
Ranch Hand
Posts: 1290
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I build several JPEG files using JFreeChart in an automated process.

I then want to display these created JPEGs to the user and give the illusion of animation.

So, what I want to do is to have each image appear in the same place on the JSP page to give this illusion of animation.

However, when I try to display the three images in a for loop, I end up getting three images down the page instead of one image that changes. (The resulting HTML page source has three img tags instead of one).

Do I need to use Flash for this or can this animation be done in JSP.

Also, I tried to do a Thread.sleep(1000), but it didn't seem to pause correctly.

I would welcome any advice or suggestions on this.

Thanks.

----

Mike
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about it.

JSP executes on the server in order to construct an HTML page to display in the browser. So any looping that you do in JSP happens in order to build an HTML to send after the JSP is executed.

So if you want client-side activity, you need client-side technology. Flash is one way, but for simply swapping out images, some very simple Javascript will do just fine.

For more on JSP please read this article.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Voodoo's Introduction to JavaScript covers switching images in Part 8.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!