Let us now test what we have learnt so far in our SCWCD exam preparation series.
Question 1: What language is used to write servlets and JSP?
Question 2: What is the servlet life cycle and who manages it?
Question 3: What protocol do servlets and JSP use to communicate with clients?
Question 4: What is the relationship between servlets and JSP?
Question 5: What is the benefit of using a Servlet instead of CGI?
Answer 1: Servlets are written in the Java language. JSPs on the other hand use a combination of HTML and Java. Eventually JSPs are converted into a pure Java servlet.
Answer 2: The servlet life cycle refers to the loading, initialization, invoking, and killing of a servlet. The container manages this life cycle
Answer 3: Servlets use the HTTP protocol
Answer 4: JSPs are converted to servlets. First, the JSP source is parsed and a Java source file is generated. Then this source is compiled into a Servlet
Answer 5: A CGI spawns a heavyweight process for every request it receives. It is both resource intensive and not scalable. Whereas, a Servlet spawns only a lightweight thread for every request it receives. Hence it is faster than CGI as well as much more scalable when compared to CGI.
Previous Chapters: Quick Recap - Chapters 1 to 5
Next Chapter: Chapter 6 - Servlet Handling of Http Requests
© 2013 by www.inheritingjava.blogspot.com. All rights reserved. No part of this blog or its contents may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission of the Author.