Why JSP Sucks So Hard
I've been working (again) on taking a project from HTML to JSP, and doing so reminds me (once again) how completely horrible JSP is.
JSP has this nice impulse to take Java code out of HTML pages and put it into JavaBeans or other Java classes, where it belongs, so the HTML author doesn't need to know Java. Great, that's great. Unfortunately, the "not Java" that is included in the HTML page is completely alien to (most) HTML authors, that it might as well just be Java for all they know or care. So I have to put <exec:iterator condition="<%= shopBean.validate() %>"> right here, or nothing on the page will work? Yeah, okay. How do I test that again?
The result of this is simple and stupid: once again my UI engineers will be taking perfectly good HTML written in Dreamweaver and tearing it apart, throwing out some of it and rewriting other parts of it, just to make it work with the JSP they're writing. Once they're done, the HTML author will have absolutely no clue what the page does any more, and will have no desire or ability to edit it. When we insist that no really we need this redesigned, we'll spend twice as long doing it (doubling our costs, negative ROI, bad technology choice, yadda yadda yadda) since the HTML author will need that long to write in sample data and then have the JSP author tear it out again.
This is completely stupid. It's as if your compiler tore up your source code every time you compiled, and you had to go back and reverse engineer your source again in order to change the binary. Stupid! JSP is only an effective solution when the JSP author is also the HTML author.
I want something different. (Yeah, yeah, I know. HTML templating languages are one of the most over-implemented pieces of code ever. Every single Web design shop, tools vendor, large Web site operator, and two-bit commentator like me has their own stupid solution to the problem. I'm tilting at windmills. I'm wasting my breath. Whatever. The reason there have been so many solutions, and there continue to be so many solutions, is because the problem is still completely broken. It wastes my time and the time of the people I work with and I still want it to be better.) I want something that lets HTML people write and keep their source code in their favorite tools, adding dummy data and seeing how it looks, and lets them add hooks for the Java coders in a way they'll easily understand.
This general problem -- separating markup from other kinds of document information -- was handled very well by Cascading Style Sheets (CSS), which separate document markup from stylistic presentation information by linking the HTML document to an external style document. CSS did this by adding very minimal changes to HTML itself -- namely the "class" and "id" tag attributes -- and putting almost everything in the stylesheet.
I think what's needed instead of stupid JSP is exactly the same type of solution for separating code and HTML. Give me a "code" attribute that I can add to any HTML tag, and overload the "id" attribute. Have the value of the code attribute be an opaque string referring to a codesheet, linked to the HTML document by a a '<link type="text/ccs" rel="codesheet" href="code.ccs">' tag. Have the codesheet use a CSS-style rules specification for indicating which Java (or whatever) class should consume tags with that code or id attribute. Then tell the HTMLer to add the "code" and "id" attributes to the right place in their existing documents, and they're done.
What's important about this is everything it doesn't try to do:
I know I'm glossing over a lot, but I think this is the right model. Has someone already done this? I'd love to see it, if so, that I might boot JSP out the window as it so richly deserves.
Marc Hedlund is an entrepreneur working on a personal finance startup, Wesabe.
Comments on this weblog
1 to 43 of 43
2005-01-21 11:19:51 PicoIco [View]
2004-09-05 07:31:51 treespace [View]
Is JSP Really Suck?
2004-09-02 21:08:20 [View]
2003-12-05 09:09:17 anonymous2 [View]
2003-10-28 16:04:42 anonymous2 [View]
2003-10-15 05:29:46 anonymous2 [View]
2003-07-25 07:22:50 anonymous2 [View]
2003-02-05 11:22:21 anonymous2 [View]
2003-02-04 01:06:22 anonymous2 [View]
2003-02-04 01:06:10 anonymous2 [View]
2003-01-31 08:23:47 anonymous2 [View]
2003-01-20 17:45:51 anonymous2 [View]
2002-12-21 09:25:48 anonymous2 [View]
2002-12-20 13:38:46 anonymous2 [View]
2002-12-20 11:45:02 zodiac1 [View]
2002-12-20 07:36:02 anonymous2 [View]
2002-12-19 20:11:36 natalieng [View]
2002-12-19 02:01:55 anonymous2 [View]
2002-12-18 20:37:51 anonymous2 [View]
2002-12-18 19:51:41 anonymous2 [View]
2002-12-18 07:05:32 mxc [View]
2002-12-18 06:20:04 anonymous2 [View]
2002-12-17 13:18:10 anonymous2 [View]
2002-12-17 12:15:59 anonymous2 [View]
2002-12-16 17:43:21 anonymous2 [View]
2002-12-16 09:35:51 anonymous2 [View]
2002-12-16 08:29:05 Kevin Bedell | [View]
2002-12-15 23:17:52 anonymous2 [View]
2002-12-15 20:31:58 anonymous2 [View]
2002-12-15 09:37:14 mentata [View]
2002-12-15 09:31:41 efsavage [View]
2002-12-14 17:46:03 anonymous2 [View]
2002-12-14 16:59:55 anonymous2 [View]
2002-12-13 17:04:04 anonymous2 [View]
2002-12-13 17:03:40 anonymous2 [View]
2002-12-13 14:26:08 buchansa [View]
2002-12-13 14:22:00 shodson [View]
2002-12-13 12:55:25 anonymous2 [View]
2002-12-13 12:04:13 anonymous2 [View]
1 to 43 of 43
Return to weblogs.oreilly.com.