File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes problem in pointing to a servlet from image tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem in pointing to a servlet from image tag." Watch "problem in pointing to a servlet from image tag." New topic
Author

problem in pointing to a servlet from image tag.

gayathri murugesan
Ranch Hand

Joined: Dec 21, 2009
Posts: 32



this is the servlet that i am trying to call from another servlet using

out.println("<img src='/worst?id=5'>");

but i am not getting the image . please help me out.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

It's possible that URL doesn't point to your servlet correctly. It's possible that the SQL query doesn't select any rows. It's possible that your database code throws an exception. I'm sure there are other possibilities. So given all of that, it would help if you explained exactly what you see instead of just saying you don't get the image. You might also want to review the server logs and debug your servlet code to see what, if any, lines of code are being executed.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

As Paul Clapham said, "explained exactly what you see instead of just saying you don't get the image".

Check the url that your method is creating. It is possible that this url is poiting to some invalid link.

[=


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

As Paul pointed out, most likely the URL is invalid. Do a View Source of the page and cut/paste the URL of the image tag into the browser address bar. Does the image appear? If not, the URL is not correct.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in pointing to a servlet from image tag.