My pet store is better than yours!

admin | May 3rd, 2007 | programming  

So I’m sitting in the airport and I was looking over the Java Pet Store (https://blueprints.dev.java.net/petstore/) application from which the CFPetMarket application is based. After some reading over the last few weeks I think I’ve been able to clear up some confusion in my head. Initially I thought that the application was exercising plain old Java. Then I realized I’m an idiot and the standard way of constructing web-apps in Java is via the JEE framework. Now that this is setting in, I’m thinking crap. Check out what they are attempting to exercise via the sample application:


This application also demonstrate the use of various features of the Java EE 5 platform such as:

  1. JavaServer Faces: Many of the AJAX features are implemented as reusable JavaServer Faces components.
  2. Java Persistence API: The application uses Java Persistence APIs to create an object/relational mapping layer.
  3. Dependency Injection: The application uses dependency injection instead of deployment descriptors.

Crap. So I can use XML Forms to show a comparison to JSF, but I’m not sure how I can implement AJAX features w/o using an API like Spry. ColdFusion has a couple tags for <cfselect>, <cfupdate>, and <cfinsert> but nothing as robust as a standard interface API for object persistence. As far as the dependency injection stuff, deployment of a CF app in a stand-alone server install doesn’t support bundling, so I’ll ignore that for now.

Does anyone have any ideas for what I can do to setup the Pet Store app in CF to mimic the functionality that the JEE 5 framework can provide?



Tags: , ,

Discussion

  1. AdamFortuna Says:

    Sounds like you’ll have to use some JS library for the ajax stuff, unless you plan on waiting until CF8 comes out that is. It could be written into a XML forms xsl technically. Those are what create the alerts used for typical form processing actually, so there are examples of those in the cfide/scripts/ folder. There’s a lot of possibilities in there, but hammering out a reusable form component where all cases are covered is pretty tricky.

    I like the rails way of handling persistence, which can be utilized in reactor or transfer. Basic idea is that form fields have names like “user[username]” and user[first_name]” then when it hits the server you have a “user” struct with keys for username and first_name. This can be passed right into a reactor DAO without a problem, and I think transfer has a setMemento() function that can be used to populate a bean from a structure, which can then be saved. Validation needs to be done before either case though, which is it’s own problem.

  2. admin Says:

    Adam – After some thinking, I’m probably gonna hold off until CF8 to put together something that is comparable to what they’re doing in JEE 5. AJAX data binding and <cffeed> will help out a lot. I think I’ll have to rely on good practices for the persistence stuff for sure. Since I want to implement the frameworks as a supplemental task, it’ll be easy to show how Transfer/Reactor/etc provide a benefit.

Add A Comment