This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Mixing content
Similar Threads
Fetching an image from the specified URL and resizing it.
how to find the size of web page
Problem running Servlet
Showing image from servlet
urgent - display Image (binary) + html in single page