| Author |
View JPG Image from Servlet File
|
Kondal reddy
Greenhorn
Joined: Sep 23, 2003
Posts: 22
|
|
|
how can I show JPG file in my jsp ...that jpg coming in servlet as a File format...if any one know help me.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56210
|
|
|
The same way that you show any other image: with an <img> tag. If the image data is being served up by a servlet, be sure that the src attribute of the tag references the servlet as appropriate.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Kondal reddy
Greenhorn
Joined: Sep 23, 2003
Posts: 22
|
|
Hi bear thanq for responding ...actually my servlet getting like this : FTPFile[] files = lObjRemote.list(); File file = null; for (int i = 0; i < files.length ; i++) { String fileName = files[i].getName(); // ?? ??? ??? ?? String extension = fileName.substring(fileName.lastIndexOf(".") + 1); //System.out.println("fileName = "+fileName); System.out.println("in servlet fileName = "+fileName); long size = files[i].getSize(); //System.out.println("size +"+size); // ?? ??? 0?? ?? ?? ??? ??? //System.out.println("bfore size"); if ( (size > 0) && ((extension.equalsIgnoreCase("jpg"))||(extension.equalsIgnoreCase("xml")) )) { file = lObjRemote.get(fileName, fileName); System.out.println("inside servlet jpg file *** = "+file); //ftp.put("c://jk",""); } } System.out.println("file = "+file); System.out.println("files = "+files); so how can take that file into Jsp...have to use FIstream...
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56210
|
|
|
Ah, you need some help with the servlet itself. I'll move this to the servlets forum for you.
|
 |
Neeraj Dheer
Ranch Hand
Joined: Mar 30, 2005
Posts: 225
|
|
Try something like the following code for sending the file to the client:
|
 |
 |
|
|
subject: View JPG Image from Servlet File
|
|
|