?
Solved

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

Posted on 2004-11-19
5
Medium Priority
?
330 Views
Last Modified: 2010-04-01
Hello,
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

Randy
0
Comment
Question by:paries
  • 5
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12626637
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 :-)

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12626660
http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets-p2.html

Does something like this :-)

And comes with source code :-)

Good luck!!

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12626706
http://today.java.net/pub/a/today/2004/04/22/images.html

is a cool (and more recent and simpler) example too :-)
0
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 12626752
With that last example, the code you want to have a look at is here:

http://today.java.net/today/2004/04/22/images.tar.gz

inside

serverimages/src/jsp

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) :-)

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12626956
Good luck with it :-)

Tim
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
Last month Marc Laliberte, WatchGuard’s Senior Threat Analyst, contributed reviewed the three major email authentication anti-phishing technology standards: SPF, DKIM, and DMARC. Learn more in part 2 of the series originally posted in Cyber Defense …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question