Creating images(buttons) on the fly via jsp/servlet

I have a menu on a page that is generated dynamically. Since some of the menu items are user created  i have always had to use regular text. I would like to use images, but i would have to create it on the fly. I have seen some perl libs that allow you to do this.. Has anyone seem or created something where you can create image menu buttons on the fly using jsp's/servlets?

I hope this question makes sense

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Getting a servlet to generate a JPG is really quite simple :-)

The process goes:

1) Create your BufferedImage
2) Draw on it (text, etc)
3) stream it back out as a JPG

then you can do:

<img src="myServlet?text=Hi">

for example :-)

Hang on, I'll find you an example off the web :-)


Does something like this :-)

And comes with source code :-)

Good luck!!


is a cool (and more recent and simpler) example too :-)
With that last example, the code you want to have a look at is here:



there is text.jsp

So that shows you how to generate images using a JSP rather than a servlet (and the ImageIO method for writing the image out is much neater) :-)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Good luck with it :-)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.