Bookmark Topic Watch Topic
  • New Topic

Image Display problem

 
Simpson Kumar
Ranch Hand
Posts: 261
  • 0
  • Mark post as helpful
  • send pies
  • 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.

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
This may help: http://faq.javaranch.com/java/RelativeLinks
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Anyone please update on this???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
I still have no idea what your code has to do with PDFs.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • 0
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
the error i got it
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic