Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes HFJS - small doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HFJS - small doubt" Watch "HFJS - small doubt" New topic
Author

HFJS - small doubt

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Hi,
In HFJS, on page 42, the lines are:
1] user click on a link that is URL for servlet.
2] web container sees that URL is for servlet so it creates.....

But 2-3 pages before, it is written that, when web server sees that request is for servlet, it transfer that request to web container.

So on page 42, it is intentionally romoved web server or what???
Please comments.

Thanks.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The web server isn't required, so it doesn't really matter whether the request comes from the web server or directly from the client, does it? That is, it makes a difference, but in terms of calling the container it doesn't really matter.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Now on page 71, why web server forwards request to web container even if request is for HTML page?

Web sever can directly find that HTML page and send it to the client, and when request is for servlet then it should forward request to web container...

Please clear my doubt...

Thanks.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Without having access to the book in question or at least a look at the source code I have no idea what you mean.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by David O'Meara:
Without having access to the book in question or at least a look at the source code I have no idea what you mean.


Actually, what they wrote everywhere is, every request goes to web server, now if request is for HTML page then web server finds the page and send that page but if request is for Servlet then web server forwards that request to web container and then container finds, loads, initialize servlet and then.....

I think now my point is clear...

Thanks.

Adrian Perry
Ranch Hand

Joined: Jul 21, 2005
Posts: 42
Hi,

If you go couple of pages further say on pg75, there is an action attribute in the form tag. This action attribute tells the webserver that it is a call to the SelectBeer.do. The webserver tries to find out what is SelectBeer.do and decodes the fact that it is a call to servlet from web.xml file.

So what the book says is right. If just static pages were to be displayed then webserver will not call container and will return the page to the client, but if dyanamic pages are to be generated or it is a call to servlet or jsp or anything dyanmic then webserver calls container.
Hope this clears ur doubt.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Adrian Perry:

The webserver tries to find out what is SelectBeer.do and decodes the fact that it is a call to servlet from web.xml file.


I am sure, this should be something else, it is container job to see web.xml and.....
Web server can't do this...

Please comments...
Thanks.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFJS - small doubt