File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet best practices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet best practices" Watch "Servlet best practices" New topic
Author

Servlet best practices

Simon Good
Ranch Hand

Joined: Sep 19, 2002
Posts: 30
Hi
I've been given the unfortunate task of building a web site using servlets and a third party templating technology. That means JSPs are strictly out. Can anyone point me in the direction of some documentation on building java apps using purely servlets. There must be some best practices for this kind of thing.
Thanks
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Turn that frown upside down!! hehe.

Not being able to use JSPs is not the end of the world. If the 3rd party templating stuff is Velocity, then I'd start to smile. I've used it before a few times and have loved it always, and haven't missed JSP at all. The rest of this post assumes that by "JSPs are strictly out" you mean "I have a presentation layer OTHER THAN servlets" (that being: the templating technology you spoke of).

As for tutorials on model-2, I admit I've always been dismayed by the utter *lack* of good ones. The one tutorial on servlets, and JUST sevlets on java.sun.com is from 1996. Everyone always seems so gung-ho about talking about Model-2, but then when it comes time to do some samples, they always run back to doing JSP pages. That is: they ignore their own advice.

A much more recent one is the J2EE tutorial,
found here but this is much more than just servlets, and it contains a lot of implementation details regarding the RI J2EE server. Let's not even go there!

Other links I've found, with varying usefullness:
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html
Very dated, ignore everything that makes mention of a jswdk, or that makes you go "Well DUH!" (like the last sentence in the 'So What's Wrong With Servlets?' section)
http://www.stardeveloper.com/articles/display.html?article=2001060501&page=1
This is an entire chapter from Professional JSP 2nd Edition on using JSP/Servlets/Beans in a MVC (model2) architecture. Decent reading, just translate any of their JSP stuff into your templating technology.

http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index1.html
That last one seems more up your alley, and has the added benefit of being recent!

And no discussion of this sort should leave out a mention of frameworks.
struts While struts has a JSP taglib and recommends JSP for view layer.. in reading their docs you'll probably gather a lot of good information on model2.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

one last one "from the source"
http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet best practices
 
Similar Threads
Float addition giving wrong value
Best Practice for @BypassInterceters
I can pass a value from a jsp to a class ?
STRUTS: WHY???
Coding standards please