You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Smith <sa...@home.com> on 2000/11/05 04:03:18 UTC

Re: JSP vs Servlets...

Rui,

Try the following experiment. Put the source code
below into a file called hello.jsp in the /examples/ROOT directory:


<%! String hello; %>
<% hello = "Hello World"; %>
<html>
<head>
<title>Hello</title>
</head>
<body>
<P><%=hello%></P>
</body>
</html>

Access this file by using

http://localhost:8080/hello.jsp

in your browser. Now look in the
tomcat work directory. You will see 
a folder called something like localhost_8080.
In that folder will be some files with an odd
names like 0001fhello_0001ejsphello.java
and 0001fhello_0001ejsphello.class. This
is the source code for the JSP. If you look at
it you'll see it is basically a servlet -- pretty much
what you would write by hand to say "Hello World".

The JavaServer Pages system is merely a way to 
quickly produce servlets that would otherwise be
very tedious to write by hand. 


Dave

----- Original Message ----- 
From: "Rui Oliveira" <ol...@milu.ipn.pt>
To: <to...@jakarta.apache.org>
Sent: Wednesday, December 20, 2000 11:39 AM
Subject: JSP vs Servlets...


> Hello,
> 
> can someone tell me which one is best: JSP or Servlets?
> 
> Is there a reason (beside implementatio reasons) to choose one instead
> of the other?
> 
> 
> Thx in advance
> Rui
>