Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mixing content

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
e.g.
<img src="http://myhost.com/myapp/imgservlet"/>
You cannot mix a normal HTML page (and nothing else is the result of a JSP) with some binary content.
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic