In my Netbeans server application, it works fine. However, can anybody tell me if this works for a real Client-Server application? If a client accesses that JSP page, will they be able to see the image?

Not really sure what the question here is. That's a standard HTML tag, so it has nothing to do with JSP at all - it will be sent to the browser "as-is". It also displays an image, so doesn't have anything to do with uploading...
–
Anthony GristFeb 14 '12 at 10:25

@AnthonyGrist, sorry, actually I try to ask, suppose a client make an http call to that jsp page, is that image can be viwed by the client ?
–
alessandroFeb 14 '12 at 10:28

In that case, yes. Provided that the image is in on the server in the correct location relative to the JSP file.
–
Anthony GristFeb 14 '12 at 10:29

@AnthonyGrist, yes. And then my question is, how that jsp page is translated on clients web browser ? Because, that image is on Server .
–
alessandroFeb 14 '12 at 10:32

1 Answer
1

The <img> tag is a standard HTML tag, and as such will be sent from the server to the browser "as-is", because the server-side code doesn't need to do anything with it.

Once deployed on to an actual web server, anybody accessing the page should be able to see the image, provided that it exists on the server in the correct location relative to the JSP page the tag is on. Or, more specifically, provided there is an "images.jpg" file located within an "images" directory that's in the same directory as the JSP page.

The JSP page is translated on the server, and generates HTML that's sent to the browser. The browser then uses that in the same way it would use a standard .html file - it creates the DOM from the tags, and loads images, scripts, etc from the server specified in the src attributes of the corresponding tags.

Is the image file path on server is returned to the client as full url ?
–
alessandroFeb 14 '12 at 10:38

@alessandro It's returned as a relative URL, just as it is in the HTML tag. The browser then does whatever it does (and, honestly, this isn't something I know a huge amount about) to load the image, likely by generating the full URL based on the URL of the page that's currently loaded.
–
Anthony GristFeb 14 '12 at 10:42