Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet best practices

 
Simon Good
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic