JSP and servlets

Am I correct in assuming that JSP is an extention of servlets and that to learn JSP in effect means learning about servlets? My point is, is JSP the superior technology a bit like learning JDK1.4 is now a pointless excercise as it has been superceded by 1.5 ?thanks
[279 byte] By [Haclanda] at [2007-10-2 7:39:38]
# 1

> Am I correct in assuming that JSP is an extention of

> servlets

Yes.

> and that to learn JSP in effect means

> learning about servlets?

No. This isn't necessary, as a matter of fact, it is one of the reasons why JSP exists - so people with little or no Java knowledge can build dynamic web sites using Servlet containers, assuming they have Java programmers behind them to build the tags / glue to the web app.

Still, I say having basic understanding of Servlets (at least) will help you out.

> My point is, is JSP the

> superior technology

No. JSP has a different role. It makes display easier to code for non-Java programmers (looks more like HTML/XML), and easier to support and understand later on.

JSP does horribly bad at complex application control, data selection and manipulation, or as an interface to external resources. Java and Servlets are better at these tasks (but conversly, are horrible to work with for display purposes).

They are different, JSPs and Servlets, in what task they do. J2EE is far superior when you use them both appropriately.

> a bit like learning JDK1.4 is now

> a pointless excercise as it has been superceded by

> 1.5 ?

No.

JSP is a newer technology, but should not be used to replace Servlets, but used along side Servlets to provide a better designed and manageable application.

Let the servlets control what pages the user sees when, to gather data, to talk with external resources. Then forward to a JSP which simply displays what the Servlet did all the work in getting.

>

> thanks

stevejlukea at 2007-7-16 21:22:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for your reply.

I guess I am having a problem understanding the role of Tomcat in all this. Tomcat is a JSP server and it sits on the Web Server machine which hosts the website. What does it actually do that the web server can't? And why is it often referred to as a container and not a server?

Appreciate the time taken to help me out.

Haclanda at 2007-7-16 21:22:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

>What does it actually do that the web server can't?

Runs java code.

A web server by definition serves static content. (eg Apache)

>And why is it often referred to as a container and not a server?

Because thats what it is: a [url http://www.adp-gmbh.ch/java/servlets/container.html] Servlet Container.[/url]

Tomcat is a servlet container. It sits there waiting for requests, and runs the appropriate servlet for the mapping.

When you "run" a jsp, actually it is running a "JSP Servlet" which translates/compiles a JSP into another servlet (if necessary), and then invokes that servlet.

Everything eventually comes down to servlets. JSP is just an easy way to write servlets that are mainly html code.

evnafetsa at 2007-7-16 21:22:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...