hi i want to display employ profile with image. my code execute correct but display only image which is retrieve from database. How i can display text and image both together on jsp page as profile .
I'm not sure I understand the question, but without any JSP code to look at it's impossible to help.
Moving to (more) appropriate forum; it may get moved again.
Lalit Chattar
Greenhorn
Joined: Oct 22, 2009
Posts: 11
posted
0
Bear Bibeault wrote:A JSP creates an HTML page to send to the client.
So the real question is: how does one show both text and images on an HTML page.
And I bet you already know the answer.
Thank you sir
but my image is retrieved from database as a binary stream and other information also from database.
and i want to show both on page.
for image i use response.getOutputStream.write(); function but it show only image.
i want display both binary stream as image and text..
Thank you
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
The "other information" would be part of the JSP/HTML page. Images are added to HTML pages via <img> tags, they're not part of the page itself. So, it's easy to display both text and images on the same page, but it's impossible to have both be part of the same "stream"; there'll be separate requests for the images.
actullay you need to get image from database using servlet with params
for exampple
fetchimage is a servlet to get a desired image send it with parametre
ex:fetchimage?name=amrishwa and specify
Hi Lalit, you cannot get two different content types in one response, my suggestion is to use inline frames and get two different responses, otherwise you have to store the image in your tomcat installation directory under your application, then you can access the image using <img> tag.
I know these two alternatives only, if there is another alternative please tell me so that I can learn more.
Have a nice day.
Love all, trust a few, do wrong to none.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
anusha chaitanya wrote:Hi Lalit, you cannot get two different content types in one response, my suggestion is to use inline frames and get two different responses, otherwise you have to store the image in your tomcat installation directory under your application, then you can access the image using <img> tag.
I know these two alternatives only, if there is another alternative please tell me so that I can learn more.
Have a nice day.
How about using an Image servlet to serve the image, and just embedding the URL to the servlet in an <img> tag in the generated HTML as others have said?
Mark E Hansen wrote:
How about using an Image servlet to serve the image, and just embedding the URL to the servlet in an <img> tag in the generated HTML as others have said?
Hi Hansen, can you explain it clearly, I can learn a new technique, just explain the method.
Thank you in advance.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
Just look for how to do two things:
1. How to use an <img ...> tag in an HTML page;
2. How to create an image servlet. Just do a search for Image Servlet, and you should find several examples.
The idea is that your JSP page will generate the <img> tag, where the URL will invoke your image servlet, which will serve your image.