Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Image Display problem

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
in our application we have to display 4 different images in a popup window (small external page), based on the images, user can select in the main page. i can open the popup window but I can't see the images in popup window.

I tried to do many paths where the images are stored, but no use. how can I display the images and what path I need to place in my popup jsp?

here is the code written.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This may help: http://faq.javaranch.com/java/RelativeLinks
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Try out the following path.
<img src="./pages/jpg/flower_header.jpg" width="150" height="50"....

The key is for the correct path depends on the context path (request.getContextPath())of the application.

For example if your context path is upto webcontent in a/b/webcontent/images/*.images, use ./images/someimage.jpeg
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by K Kiran Kumar:
use ./images/someimage.jpeg

Not a good idea. Use context-relative links as spelled out in the FAQ rather than page-relative links.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
thank you , it is working now.
I used request.getContextPath() + "/pages/jpg/sports_header.jpg"; and getting image. and the path in logs showing

but I applied same path to generated PDF file, but its not working and the path in the logs showing where the image doesn't exists (with C: folder path). and the path is wrong

how can i get images in pdf file?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Anyone please update on this???
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please read this.

What does the PDF file have to do with the JPG file? If you want an answer, you need to be clear with the question.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Actually My PDF file contains data ans as well as images. I can create the data into the PDF and when it comes to add images, I can't find the exact path to attach. the same path I applied to jsps and I can see the images in jsps.

is there any alternate way to add image to pdf rather than
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I still have no idea what your code has to do with PDFs.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Actually its completely related to PDF generation (other tools), I added the same question in other tools topic but i didn't get any response to this. I asked in jsps and I got good results when comes to display images in jsp, but still getting error in PDF generation. If you understand the PDF related code, then I will attach to this topic.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
If you're getting an error, then you should tell us what that error is.

If it's related to a file path, how have you made sure that the path is correct? How have you made sure that all permissions are set so that the servlet container can access the file?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
the error i got it
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by sumant kuchipudi:
Actually its completely related to PDF generation (other tools), I added the same question in other tools topic but i didn't get any response to this.


Ah I see what's happened. This actually has nothing to do with the original question, and is a self-hijack duplicate of your other post. Please don't do that. Starting a new question in an existing post is confusing, and also do not cross-post the same question in multiple forums.
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    Bookmark Topic Watch Topic
  • New Topic