Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thumbanil to larger version of image using java

 
Sujatha Kalluri
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have problem in opening the new window in javascript in javascript using window.open(url, windowname, etc..), the url is broken.

when I click on thumbnail image, I have to show the larger version of image,

my image path goes like this...
a href ="javascript:myPopup("//shor/project/webapp/images/beach.jpg", "somename")>


so... my images are to be fetched from folder, when I am passing them to javascript function



the url when printed in javascript function is not as original one but is coming out as /shorprojectwebappimagesbeach.jpg, path is broken, thus in new window it is telling could not find resource.

how do I get original path in javascript.. if it is not possible with javascript, how do I do in java, I wanted to use javascript instead of directly opening image from because in the new window I dont want to have menu bar, tool bar, directories etc, is it possible to do that in java itself ie opening a new window without having menu bar, tool bar etc. By the way I have set of images that needs to be fetched from folder, so my logic is in for loop , not just one image.

thanks in advance for any help,
Sujatha.
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This forum is for Java -- not JavaScript.

Moving this topic to the Javasciprt forum.

Henry
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> //shor/project/webapp/images/beach.jpg

The URL you need to pass can't be the the real URL on the web server, but had to be the URL that the JPG would be accessed from the client. For example, if the web site is:
http://www.mysite.net/shorProject/
The the URL you might want to pass would be:
http://www.mysite.net/shorProjects/images/becah.jpg

Remember that the Javascript popup is run on the client machine, not the server. So the client doesn't have a shor/project.webapp/images/beach.jpg. The client only has access to the website, so the image needs to be in a publicly accessible directory and referenced via the web-sites URL to that location.
 
Sujatha Kalluri
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

to correct my previous thread... the images I am getting are not from webapp folder... but it is some network folder

say....//shor/images/inputimages/beach.jpg.

how do I access network folder in javascript.

if it is not possible can I do it java. my criteria is my new window should not have directories.menubar, toolbar etc.

thanks

Sujatha.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the image is not web-accessible then it cannot be accessed by URL, using JavaScript or any other technique.

You'll need to address a servlet that reads the image from the file system and streams it as the response.

Do a search on the Servlets forum -- this has been addressed many times.
 
Sujatha Kalluri
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if is working why canot it work with <a windowname...) <br /> where url is "//shor/images/inputimages/beach.jpg. <br /> <br /> why cant we use file system call in a href. <br /> <br /> Sujatha. rel="nofollow">
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sujatha Kalluri wrote:why cant we use file system call in a href.

You can answer your own question by thinking about the answer to this question:

Where and when is the href evaluated?
 
Sujatha Kalluri
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

this is working for me when I used escape() function to url before sending to javascript and using unescape(url) in window.open of javascript.

also since backslash is escape character in string literal.. I used java regular expression to replace each backslash to double backslash. then I used escape() to send to javascript.

Sujatha.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer this question: will it work when the browser is running on a machine that does not have the network share mapped?

In other words, no, it is not fixed yet.
 
Sujatha Kalluri
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my case.. it is working since client is on same machine as server, as you said if it doesn't have mapped network drive.. it will not work..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic