CHoosing a front-end tech

September 30th, 2003 by Hen

I want to do a nice simple website. Something I’ve done before and will do again in the future. It will have a RO consumer view and a RW admin view.

I’ve got a schema in postgres, and a hibernate mapping that is working nicely. Now I need to choose how to do the HTML [with however many layers in between]. It should have minimal amounts of coding, but should not have bits of Java written in the JSP [or equivalent, ie) velocity] page.

Options I’ve considered so far:

JSP: I like using this as it’s simple, easy and fun. There’s no hibernate taglib, and I don’t believe in writing bespoke business taglibs, so I’d have to make at least some kind of basic hibernate taglib or hibernate/OJB pluggable taglib. See how quickly it gets overmodelled :)

Velocity: Good featureset a year ago. I’d be using JSTL/Tomcat,, maybe even Tomcat 5/JSP 2.0, so I’m not aware of anything [except a certain bash syntax] that velocity would have over it.

Struts: I’m not comfortable using Struts. Even with xdoclet to generate things, it involves writing Java classes which I don’t think I should need for a basic system. Ages back [Struts 0.3] I hacked it so that I could throw Maps around instead of Forms and wrote generic actions. I could go that way again. I don’t think Struts is dynamic and fun enough for what I want.

WebWork: Heard good things. Looking at the docs though I find it hard to see what the difference is between that and Struts. Seems to have the same overall design concepts.

Tapestry: Could be a possible. I ought to rethink it. I hated Tapestry a year ago as it seemed to stop me being able to do what should be simple things. It defines a simple-world, and is a pain to get outside the borders. However, I’m considering an easy system and would accept such a strait-jacket if it means I can be rapid.

Proprietary: A few years back in a previous job, I designed such a system. With some newer ideas I could spend time using the site as a driver for my own version of this system. [NDA-wise, I promised to not look into the concept for a year after leaving the company, it’s been 2 years now]. I’ve even recently come up with a name for it.

What and who else is there? JSF is too new, and seems more work than Struts. Freemarker is something I’ve only vaguely heard suggested. BeanShell pages? Do they exist for the latest version of BSH? Servlets are probably too much work.

Any opinions are gratefully received.

12 Responses to “CHoosing a front-end tech”

  1. Chad Johnson Says:

    Here’s what I do for the display layer:
    -JSP
    -JSTL

    Backend layers:
    -Struts
    -Hibernate

    Slick things is, you don’t need a taglib for Hibernate. Hibernate will ultimately give you a List (java.util.List) of your persistant objects.
    So you can just use the “forEach” jstl tag.

    Hope that helps.

  2. Brian McCallister Says:

    If you really don’t want to write much Java, look at Cocoon. It takes some effort to wrap your head around it, but it includes the kitchen sink. It is basically the Perl of app server tools =) It also plays nicely with Hibernate and OJB directly from the configs.

    For what it’s worth, I *want* to put Java classes with my logic in them for all bu the simplest applications. Logic belongs in Ruby, but Java is close enough.

  3. bayard Says:

    Being able to pass the objects from Hibernate into the JSTL is nice, but I’d not want to bother with Struts just to call the store method [and other transaction bits]. But good point, Hibernate’s style means that the taglib needs to just be a pretty basic setup.

  4. bayard Says:

    Back when I was messing with these ideas a while back, we used Cocoon 1 on a project. It connected nicely onto the front of the system, but XSP/XSLT was not the nicest language, and a bit new to everyone then. Maybe trying Cocoon again is the way to go.

  5. bayard Says:

    Oh, on the logic comment.

    I want to plug the logic in as interceptors. Basic concepts should exist by default, CRUD stuff, searching/filtering. I should then be able to plug bits into those concepts by interception/pluggability. I also should be able to write new concepts, like ’subscribe’ and ‘login’.

    Maybe HiveMind/AOP are a possible. Interceptors appear to be terms I hear a lot in those areas.

  6. Jason Carreira Says:

    If you need interceptors in your web app to modularize your code, but don’t want to go for AOP yet, check out WebWork2…. You can apply Interceptors to command processing, and this is in fact how much of the functionality is implemented (and can be plugged in piecemeal).

  7. Hoy Palloy Says:

    How about using the tagbox project from sourceforge to generate the xml then xslt for html transformation - nice and clean.

  8. On XSP etc Says:

    I think XSP’s are nasty vicious things, but I still like Cocoon a lot. If maximizing performance is not of prime importance I use Velocity in Cocoon. Unfortunately, XSP’s provide about a two to fourfold speed improvement over Velocity in Cocoon as Cocoon feels the need to convert everything to SAX events.

  9. domagoj Says:

    Projects:

    http://sourceforge.net/projects/echo
    http://sourceforge.net/projects/echopoint

    they are like JSF or Tapestry (real components) but much more like Swing and not mind bending like Tapestry.

  10. Howard M. Lewis Ship Says:

    Tapestry has changed overwhelmingly in the last year; the 3.0 version (now in late beta) is worth a new look … everything is simplified and streamlined without sacrificing power. You can do a *lot* more in your HTML templates, almost like a JSP, but cleaner … and you have the option to do less in the JSP as you wrap your brain around Tapestry and the advantages of seperating concerns. I’m very proud of what’s happened to the code over the last year or so, and of how far the team has come as well.

    Work on the Tapestry in Action book is winding down, at which point I’ll be able to fill in the gaps in the free documentation and push Tapestry to a 3.0 GA release.

  11. Dan Campers Says:

    Spring framework also has a nice MVC part to it amongst other things. www.springframework.com and http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step.html

  12. Daniel Sheppard Says:

    In terms of the actual template/page renderer, have a look at Freemarker (http://freemarker.sf.net). I’ve been using that rather than JSP lately, and I’m quite liking it - much more intuitive than jsp. Similar to velocity, but much more powerful and flexible.

    You can definitely use freemarker within a struts environment. I’m not very familiar with webwork and tapestry, but you might be able to use it there as well.