Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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!
Have you tried LearnNowOnline?
subject: Mixing content