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

Http Response

 
siddharth das
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ,
i want to send a picture from server to client
so that i write

but if i need send image and text,then what i will write.
please suggest me.Thank You.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can send binary data or text, not both.
If you describe what you're trying to accomplish, maybe someone here can point you in the right direction.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only have one content type, text or image. The text (or rather, HTML) can contain an image that once again references the servlet so that it serves an image; but that would be a separate follow-up request.
 
siddharth das
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suppose a client sends her name.
The server should display her name with a jpeg photo.
so how can i write
Thank you[ ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Return an HTML page that contains an <img ../> tag.
The tag should have a 'src' attribute that points to your image servlet.

I have an example app that does this on my site.
http://simple.souther.us
Look for SimpleStream.
 
Saurabh Patil
Ranch Hand
Posts: 48
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. Ben is right, simply return a html page which contains an image!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic