Vita Rara: A Life Uncommon

Programming

Compiling JasperReports JRXML Files with Maven


Categories: |

I recently started using JasperReports in Quadran. I'm using Maven to manage the Quadran project, and I wanted the JasperReports to fit into the process like everything else.

There is a Maven plugin in the Mojo collection for compiling jrxml files. Currently the plugin is in the sandbox, so you will need to check it out of Subversion and install it yourself in your local Maven repository.

ApacheCon US 2007: Using Groovy with Struts 2


Categories: | | | |

I received an email from ApacheCon today. They have accepted my Using Groovy with Struts 2 training session.

Using Groovy with Struts 2: A hands on half day training session. Learn how to use Groovy with Struts 2. Topics covered will include: Integrating Groovy into the Struts 2 Maven archetype; implementing actions, and service beans in Groovy; using Spring to wire Groovy service beans and action classes; using dynamic Groovy actions that do not require a server restart; writing Data Access Objects in Groovy and using Spring based transaction support with Java Persistence API (JPA).

I don't have scheduling information yet, but I believe it will either be on November 12 or 13. Stay tuned for more information.

Creating a Login Interceptor in Struts 2


Categories: | |

Controlling access to web resources with a a login process is a common use-case. Implementing this using an interceptor in Struts 2 is very straight forward.

The parts of the solution:

  • An interceptor class,
  • An interceptor definition in our struts.xml file,
  • An interceptor stack that uses our interceptor in our struts.xml file,
  • A global result in our struts.xml file,
  • A JSP page to accept the username and password,
  • A service bean to process our user's login attempt,
  • A way to wire our service bean to our interceptor.

ApacheCon 2007 US Submissions


Categories: | | |

I've submitted three proposals for talks at ApacheCon 2007 US, login to see the proposed sessions and give feedback on them.

I've never submitted a proposal to do a presentation at a technical conference before. So, this is a first. I've done a lot of training and mentoring, but never worked for an employer who saw sharing the knowledge as something of value they wanted their employees doing. (It's good to be self-employed now!)

Post and Redirect in Struts 2


Categories: | |

Redirecting a user of a web application after submitting an HTTP POST is a common pattern. A common use case is to redirect to a display page after a user has created something, such as a purchase order or sales order.

This post and redirect pattern is supported by Struts 2. The means of doing this wasn't obvious to me, but some reading and searching turned up the answer. There are some examples around for doing a redirect using static parameters, but that doesn't help when you want to redirect someone say to display the order they just placed on your website.

Redirects in Struts 2 can use static or dynamic parameters. Here's a simple static redirect:

The Definitive Guide to Grails


Categories: | | |

I picked up a copy of The Definitive Guide to Grails this week. I'm most of the way through it, and I'm impressed. The Grails team has definitely done a lot of work. As a result I've started to dig into the code, and I'm getting a lot of ideas for Groovy Works.

Overall I highly recommend getting a copy of the book, whether you use Grails or not. It is well worth a look.

I'll post more thoughts when I finish the book.

Groovy Struts: Spring AOP Issues


Categories: | | | |

On the Spring forum we've been having a lively discussion about AOP support for scripted beans. Rick Evans has said the issues are not fundamental, and that he would be addressing them in the next few weeks.

I find this quite exciting. I'm really looking forward to a day when I can start my application server and just code. I'd really like to get rid of most, if not all, of the restarts.

Groovy Struts Update


Categories: | | | | |

(NB: For the latest on the subject see: Groovy Works.

I worked with using Spring to instantiate the action beans today, and that didn't go too far. I started getting an exception from AspectJ. (See thread on the Spring forum.)

So, I got to thinking. What if I created the GroovyClassLoader in Struts 2 prior to initializing the Spring context, and make the GroovyClassLoader the parent of the Spring context. This works! Finally something that works. It's not really enough though, and it's very cludgy. I would have to have two source trees, one of Groovy files that need to be compiled ahead of time, and one of others that are compiled and loaded at run time. That would make for a messy project in my eyes.

Toward a Groovy'er Struts 2


Categories: | | | |

See latest update: Groovy Works

A further update is available here.

Last week I started implementing my Struts 2 actions in Groovy. After a few days I decided I liked Groovy, but I wanted more. I didn't want to have to restart my servlet container every time I recompiled a class. I just wanted to be able to edit, save, and reload in my browser.

I researched using Spring to instantiate my actions, but Spring's scripting integration only supports singletons. So, to get around this I extended the Struts 2 Spring Plugin to integrate the GroovyClassLoader. That created problems with Spring's use of AspectJ's pointcuts to support declarative transactions. (Thread on Spring forum.)

Web Page Data Models: Where do they go? Part II


Categories: | |

Well, I finally decided where they go. At least for the Quadran project. My package structure looks like this:

Syndicate content