This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Dear Ranchers, A design level question.... When do i go for servlets? When do i go for JSP? Since both are going to be finally servlets..... While designing an Web App when do i say this will be a JSP and this will be a servlet? Is there a rule of thumb to say this functionality will be better implemented by Servlet or JSP? Where would a Servlet fit better than JSP(Examples)? Thanks YRK
You are not fed, if you dont ask. <img src="wink.gif" border="0"> <p>SCJP 1.4, i2CP, IBM s390 CP
you have to use the mvc design pattern to facilitate proper separation of servlet and jsp. a servlet acts as the c(controller),which verifies from data,updates the model with the form data,and selects the next view as the response. a jsp pages acts as the view ,which renders the html response,and and provides html form to permit user interaction.
And don't forget - JSP are designed to serve character streams only - if you need to serve image or other binary resource data, it will have to be with a servlet. See numerous discussions on the JSP forum about images. JSP should be regarded as a convenience only - for applications that have a preponderence of pre-formatted HTML. If your HTML involves a lot of computed content, a servlet is probably best. Bill