struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Flores <aflo...@umd.edu>
Subject Re: 2 newbie questions about Struts and JSP
Date Tue, 23 Sep 2008 13:43:32 GMT
If you are developing using Tomcat (hopefully you are), consider reading 
the comments (and documentation) on the Jasper 2 JSP Engine. 
Particularly look here:

http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html

Specifically, trying the flags "keepgenerated" will bring some light to 
your question. If you are using Eclipse (or any other decent IDE), also 
consider putting a break point in a jsp page and take a look at what the 
variables show you.  This will bring lots of goddies to your studying.

Concerning Struts (or Spring MVC), Struts 1.x and Spring MVC use a 
servlet to control incoming requests whereas Struts 2.x uses a Filter 
instead. They do not implement any JSP specific interface as they are 
not concern with JSP technology.

JSP is (IMHO) a rendering technology (think of it as a servlet that 
simply outputs HTML code to the output buffer writer).  Technically, 
it's the "V" in MVC. Granted you could do it with a servlet, but JSP was 
born with the idea that visualizing HTML mixed with Java code was easier 
to imagine instead of writing code like :

out.write("<head></head>");  etc, etc...

Servlets can be used to be the "C" of MVC (or at least help out). This 
is a distinction I've seen pretty much everywhere I've been (when you 
implement your own).  You could write your servlets to forward to other 
servlets (jsps) of use 3rd Party frameworks.  Frameworks like Struts 
1.x, 2.x or Spring MVC delegate this mechanism to simple class (Action, 
Controller, Pojo, etc) to do the processing continuing with the MVC 
pattern. The delegation to a rendering technology typically occurs 
within these frameworks where you have options (instead of simply 
relying on JPS, now you can choose in using Velocity, Freemarker, etc). 
I've been using the latter and I'm liking it very much.

Hope this helps!


UseTheFork wrote:
> Hi, 
> 
> I am studying JSP and I understand that these pages are translated into java
> code servlets, which are then compiled and executed on the application
> server.
> 
> i) Do these 'JSP servlets' implement the HttpJspPage interface defined in
> javax.servlet.jsp?
> 
> ii) Does Struts (or Spring MVC) provide implementation of such 'JSP
> servlets'? Or does Strut (and Spring MVC) have nothing to do with this?
> 
> Thanks,
> 
> J.

-- 
--
Alberto
http://www.linkedin.com/in/aflores


Mime
View raw message