Quoting Jay Macarty ([EMAIL PROTECTED]):
> Frank,
> JSP is useful in a number of situations as summarized below:
>
> 1. JSP "hides" much of the nuts-and-bolts of the servlet code. When used in
> combination with Java beans, a developer without a detailed background in
> servlets, say a person normally responsible for HTML page layout, can still
> construct a powerful and useful web application.

This is not an advantage of JSP over servlets, assuming that the servlet
writer chooses to use one of the template systems available.

In fact, it's a disadvantage because with a good template system the
servlet writer can do an even better job of the separation.


> 2. JSP helps separate presentation from program logic. Even though the final
> code generated by the JSP procedure builds the needed code to write out the
> HTML, it is much easier to simply update the HTML in the JSP file and
> arrange things how ever you want and let the processor handle the details.
> This even opens the door to allowing a page layout designer do the HTML
> while a Java programmer codes the logic.

JSP does a very poor job of this, since by design it encourages you to
freely mix Java and HTML in the .jsp file.

A good template system does a much better job of effecting this separation.
In fact, JSP only really provides you with support for a model versus
view+controller separation--it takes a template system to realize the
full value of the model/view/controller design.

The model is your collection of Java beans, coming out of your EJB server,
or your database, or whatever. Your servlet is the controller, implemented
in 100% pure Java, and takes responsibility over controlling the session
(loading objects, authenticating the user, selecting the result data,
deciding on what view to return). Obviously the templates become the
view portion of the design.

With JSP it's easy to use beans plus JSP gunk, but harder to effect
the full three way separation (harder in the sense that there is
absolutely no architectural support for doing so. You have to
remember to maintain the separation yourself, at every single point.)

> 3. As mentioned briefly above, JSP's ability to take advantage of Java beans
> can be a very useful tool in building applications.

WebMacro can do this as well--it uses introspection much the same way
that JSP does, only in a template model. Other template systems, such
as FreeMarker, can come close, though you have to write adapters.


> 4. Because of JSP's tendency to look like Microsoft Active Server Pages,
> ASP, in many respects, it is sometimes easier for a developer making the
> transition from ASP to servlets to start out with JSP.

This is an advantage of JSP. Though not one I'd be proud of.

> I would not say that a developer should choose either JSP or servlet
> development exclusively but I think JSP certainly has its place and I am in
> the process of converting some of my pages to JSP which seem to be a better
> fit (i.e. an application log-in page).

I think JSP is suitable for quickly hacked together applications where
design is not an issue. I tend to use perl in such situations, though,
since it's more rapid development than Java.

When I move to Java, it's because there are bigger issues, and then
design becomes important. So I stick to servlets with templates.

Of course, as the creator of WebMacro I'm entirely biased. Although I
created WebMacro because of the bias, not the other way around.

WebMacro is a free template system which you can download and use at
no charge. It was recently selected as one of the best three servlet
products of 1999 by the Java report.

  http:/webmacro.org


Justin

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to