This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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 Head First Android this week in the Android 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
jQuery in Action, 3rd edition