Are JSP worth the pain ?

I've done JSP for almost 3 years now, and I can't understand anymore the ecstasy around it which seems to reign in some circles. At the beginning there was HTML, and HTML was cool. And then some spirits thought they could do applications inside a simple web browser, denying its most powerful feature after hyperlinks: the back button. So came the servlet.

But most of the times, the servlets were just full of strings, and had little code relevant to the process. So came the JSP. Over the time, servlets has been reduced to the role of an almighty controller, taking part of the almighty Model2 (or MVC 2), which is the definite absolute unevitable solution for building applications with a web frontend.

Let's remember that all this relies on HTTP, a stateless text-only protocol, primarly designed to transport HTML. All this has evolved in a patchy mess that some groups try to clean, and we face today the situation where Internet Explorer is THE browser required by corporations, even if it's the less standard compliant on the market today (think Opera, Gecko, KHtml). The problem is (and has always been) to keep a "programmatic" integrity between our objects on the server side and their treatment on the client side. Of course the client may have an object notion (applet, javascript, flash?), but most of the times, HTML forms are used. This is called serialization... The answer given by JSP is to use a text file, mixed with java code, mixed with some kinds of controls called tags, and everything is transformed in an almighty servlet with ONE method (this has been thoroughly described as "it sucks" in several articles, so I won't enforce the point). This hasn't been that much a problem until the last months when the rush for the Ultimate Taglib has begun. Normally you could use JSP not only for HTML but for all texts formats as well. But since there is no control on the linefeed and some spaces in the output stream, you are restricted to formats loosy on this matter. Typically, using a tag entails 10 to 20 times more bytecode that calling a function, because a tag manages scriptability, looping and exception handling must be taken care of. The 64kB barrier is nearby (I've encountered it only because of tags use), and frankly, tags are just a kludge on JSP... all in all, Java for the web is not great.

One thing promoted with JSP was the clean separation between the design and the code... at best it's ignorance, at worse it's a lie. A tag is just a thin layer over code, and the taglib must be declared inside the file, there is NO separation. Eventually you have:

  • at best code mixed with presentation
  • at worst no presentation, with the HTML tags strictly generated in JSP tags, which is the current trend of some "standard" frameworks
  • a page size practically limited
  • a "flexible" format, with only one practical use: HTML output
  • no answer to the real problems of object oriented web applications: how to keep in sync server and client transparently for the developper (this has already been solved of course, by Apple's WebObjects for instance)
  • a new non-standard ultra-verbose procedural language: the different implementations of JSP tags

Sincerily, are the "benefits" worth the pain?

Comments

1. On Monday 16 June 2003, 08:15 by Lunar

You really should take a look at Echo framework :

http://www.nextapp.com/products/echo/

2. On Monday 16 June 2003, 19:29 by Damien B

Hi Lunar, nothing better than a server in the USA to talk when you leave at 10 min on foot. I've looked quickly... but I'm more a "bare metal" guy. It could be a good solution for a completely in-house project, I'll be more inclined to use that at work if I've the time to test the demo application. But I can't imagine using it "privately".

3. On Monday 16 June 2003, 19:29 by Damien B

live not leave... so silly