File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes image tag in html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

image tag in html

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 361
I am going through HFSJ,chapter 1 which says that when ever the browser is rendering the html page and it comes across the image tag , it generates another HTTP request to get the resource descirbed.
I wanted to know why a new HTTP request has to be sent to server for each image tag.

java pro

SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

"java pro",
it appears that you have changed your display name from one that is valid to an invalid one.

We require display names to be two wors: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct our display name, since accounts with invalid display names get deleted.

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

A HTTP request is able to send one resource. When you request a web page, you get sent the web page. Extra 'bits' like images, fonts, favourite icons, sounds and animations are 'new' resources and they must be loaded separately with new HTTP requests.

A new HTTP request does not always require a new HTTP connection though. As a performance improvement in HTTP1.1, it supports a 'Keep-Alive' connection so that multiple requests can be sent down one connection without needing to keep establishing new connections.

Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425

As David Allready told you HTTP cannot get extra bits of images and other such things in one hit, So it has to make an extra call. Also as HTTP is a stateless protocol so for every resource it has to make a seperate call to the server.


Rahul Juneja
ThoughtClicks -
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Well, normally I would move this to the HTML forum since it is not a question about Servlets. But since there are already good responses here, I am just going to close this thread.



Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: image tag in html
It's not a secret anymore!