Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

Entries in spring (12)

Wednesday
Mar112009

Interesting Post: Java EE 6 Overview on TSS

I've been so engrossed in Spring and Grails that I have ignored Java EE and the movement to enhance and simplify it. Reza Rahman posted a great article on TheServerSide.COM on the coming changes to Java EE for version 6.  JSR-316 (the Java EE 6 Specificaion JSR) defines the changes being made. Apparently there will be some 'pruned' libraries, such as JAX-RPC, EJB CMP, and some deployment and management JSRs.

Also new in the platform will be profiles. The first non-full profile deployed will be the 'Web profile', which sacrifices JMS and a few other APIs so that an enterprise app will run within a web container (including a "Lite" version of EJB, but not including JMS).  

On first glance, the pending WebBeans 1.0 specification looks like a standardized web component framework, similar to the Seam Framework, and allows EJBs and associated JPA entities to exist and easily wire directly into the EL notation on the JSF page.  Reza claims that WebBeans is inspired by Seam and some DI frameworks (Google and Spring) but that it is not a mirror of them.  Should be interesting times once this is delivered for the Seam framework.

There is a call for participation at the bottom of the article, as well as a ton of well-placed links to more information in the JSR and other places.

Read the Java EE 6 Overview article at TSS

Wednesday
Dec032008

Bloggers at SpringOne!

Here are a few blog sites covering the SpringOne conference:


  • Grey Bearded Geek - Chariot's Rich Freedman has been writing about the keynotes, sesssions on his blog

  • It Depends (tm) - Chariot's Dmitry Sklyut writes about the Tomcat server and other topics here.

  • New York Java Consultant - Solomon Duskis writes about SpringOne from his blog.

  • Spring in Practice - Willie Wheeler covers Spring from his blog and is attending SpringOne.

Tuesday
Dec022008

Chariot TechCast Episode #20 released - SpringOne News

I am pleased to announce the 20th episode of Chariot's TechCast. We're covering the SpringOne show from Florida from a variety of angles. Visit Episode 20 on our blog page for more details and the link to download the show. As usual, you can subscribe via the RSS Feed at techcast.chariotsolutions.com/rss or search for TechCast on iTunes.

Wednesday
Oct222008

PSUG Slides online - SpringSource dm

Rob Harrop from SpringSource presented a talk at the Philadelphia Spring User Group last night entitled "Getting Started with SpringSource dm Server".

Rob has a good set of resources on the main page, and the presentation is here.

Friday
Apr112008

Grails and Spring WebFlow

Everyone has had to code an application at some point where they were forced into a particular set of navigational flows. There are a few ui-centric workflow packages out there, including Open Symphony's OSWorkflow, and Spring's WebFlow. Other developers at my shop have worked with WebFlow and were pleased with its' features. But did you know that Grails embeds WebFlow and makes it available within its' controllers automatically?

WebFlow Basics

For a thorough introduction to Spring Webflow, I suggest visiting the SpringSource site. However, in general, webflows can be broken up into distinct components:


  • State - This is a 'definable moment' within the webflow, such as a View State, where the application is waiting on user input.

  • Transition - An event, often fired by a user taking an action, that moves the webflow from one state to another.
  • Action - Code that can be performed within a transition, or on the start or ending of a given State

  • View - A (GSP) page that is rendered during a 'view state'.
  • Flow Scope - A semi-session-like container that lives for the life of the webflow. Data captured from one view to the next

Without too much more ceremony, I can simply say that although Spring WebFlows are a great feature, and take a lot of pain out of implementing flow-based application logic, they are made even easier by Grails.

A Grails WebFlow

Here is a simple webflow that represents a fragment of a voting application. Call it KrimpleVote (or HangingChad, the system)... (I have since lost the image itself...) To build a webflow in Grails, simply create a closure ending in Flow, and embed the states, transitions and actions as inner closures. It's easier to read than it is to describe:



def registrationFlow = {

showDisclaimer {
on("continue").to "lookupVoter"
}

lookupVoter {
on("selfRegister").to "selfRegister"
on("find") {
if (!params.ssn) {
no()
return error()
}

def voter = Voter.findBySsn(params.ssn)
if (voter == null || voter.ssn == null) {
no()
return error()
} else {
flow.voter = voter
}
}.to "showRegistration"
on("return").to "lookupVoter"
}

selfRegister {
on("continue") {
Voter v = new Voter(params)
if (!v.validate()) return error()
v.save()
flow.voter = v
}.to "chooseParty"
}
...

View states are closures that do not automatically transition to another state. Take a look at the showDisclaimer closure as it's a view state. It waits for the 'continue' event to be sent as a transition from the user. You do that by submitting a form to the same closure (registration) and embedding a submitButton within the form with the name of the transition:








fragment of showDisclaimer.gsp

Note: You have to put the GSPs in a subdirectory named registration under the controller's views as it puts all webflow views in a subdirectory by flow name (without Flow). Also, the pages are pretty straightforward as well. Another nice thing is that it automatically handles the flow continuation key for you.

I've been (slowly) getting around to putting that Voter application together as a sample. Once I do, I will post it for download. Until then, I'll post some snippets as I learn more.

For more Flow goodness, check out the grails documentation page on it.