File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Mixing content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Mixing content" Watch "Mixing content" New topic

Mixing content

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
How can I mix content using servlet, i.e. I wan to generate a page containing ordinary HTML tags as well as dinamicly created JPG image. I don't want to store image on server's file system. It must be sent on the fly with HTML code.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The only way of achiving this is to provide a servlet which generates the binary stream for an image. Then your jsp would just call the servlet in its image tag
<img src=""/>
You cannot mix a normal HTML page (and nothing else is the result of a JSP) with some binary content.
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Thank you!
I agree. Here's the link:
subject: Mixing content
It's not a secret anymore!