Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP & Servlet

 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I remember reading somwhere the following difference
Servelt spawna a new process for each client request while JSP's use single process but multiple threads.
Is it true?
Given that JSP in turn compiles into a servlet, I am not sure how this can be.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet engine uses a separate Thread for each request to a servlet - as you say, JSP turn into servlets. Servlet engines keep a pool of Threads so they don't have the expense of creating a new one for each request.
Bill
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William ,
Thanks for your reply. I still have one doubt (may be foolish one!)
How does servlet engine know whether it's a simple servlet or JSP compiled servlet?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean... the servlet engine goes through some naming tricks to direct requests to a JSP to the equivalent compiled servlet, but as a programmer you don't have to worry about it.
Bill
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
It's very true that as a programmer I need not worry.
I was asked in the interview about the difference in JSP and servlet.I answered what we discussed. But when I was counter questioned how can it be different when JSP also compiles into a servlet, I was baffled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic