Vita Rara: A Life Uncommon


Maven Jetty Plugin Logging Woes

Categories: | | |

My logging issues weren't completely over yesterday. I first adopted the "org.apache.commons.logging.impl.SimpleLog" method in the Jetty plugin, but this still spewed far too many lines of logging in my Struts 2 application. The major culprit was FreeMarker. It logs a tremendous amount of data. Far more than I would ever think the average non-FreeMarker developer would ever need.

So, I decided I needed to go the log4j route, so I could control the levels for the various libraries. I copied the dependencies section as explained on the jetty page. This lead to errors when parsing JSP pages and tags. Something in those dependencies introduced something strange into the Jetty runtime environment. After futzing about for a while, and sleeping on it I decided to just delete the dependencies and still try to use log4j. Lo and behold it worked. I started with the file in /src/main/resources created by the Struts 2 Maven archetype as my starting point, and now I have a finely tuned log4j setup.

Web Page Data Models: Where do they go?

Categories: | |

You have a web page that has tabular data that doesn't represent simple rows from a database. It's a field from this table, one from that, one from four joins away. It's a little bit of data from all over your data model, but the client wants it on the screen. What do you do?

In the past I used to just a SQL result set and turn it into a Collection. Nice and neat. Iterate over the collection and put the stuff onto the screen. Simple enough, back then. Now I'd like to have better control over my models, and have them be full classes, with strong typing, setters and getters, etc.

The question is where should that class reside? Is it part of the data model? Is it a business object? It's really a presentation model. It only exists to make presentation of data easier. In essence it's like a report, or an element of a report. So, where should it live?

Maven Jetty Plugin Logging

Categories: | | |

I've gotten Maven, Jetty, Spring, and JPA playing well together! I've ecstatic. Bye, bye JBoss. I don't know that I'll never run JBoss for development again, but I don't think it will be common.

Anyway, upon getting the Jetty Maven Plugin working (mvn jetty:run) it was logging too much debug information. Hitting one page ran out a 10,000 line buffer on my terminal. There was a simple quick fix though. Add a few properties to the plugin configuration in your POM file and voila, reasonable logging.

Kicking the JBoss Habit: JBoss, JPA and Spring? Or Spring and JPA?

Categories: | | | | | | |

Hi, my name's Mark and I'm a JBoss user.

Ok now everyone.... "Hi Mark."

I have been a JBoss user for many many years. It all started with the seductive siren of Enterprise Java Beans. I still have a deployed application running on 2.4.3, or something like that. (Behind a firewall, thank heavens.) Well, today I took a few more solid steps toward kicking the JBoss habit.

If you've followed this blog you'll remember that I'm working on an ERP application for a client, Quadran. Yesterday I fought with query issues and JSP reloads for hours. With JBoss it's compile, package, re-deploy, wait. Change a few characters, compile, package, re-deploy and wait! It finally got to me.

UnRally VI: Fayetteville, West Virginia - September 4-6, 2007

Categories: | | |

Sylva and I are going to be the UnOrganizers for the Annual UnRally. This is a annual get together of BMW motorcycle sport touring enthusiasts and others. (You don't need to ride a BMW.)

To follow our progress on this project you can check out the UnRally planning forum on

New Server - A Little Xen

Categories: |

The past week has been a trial by fire. We purchased a new server to handle hosting sites, email, clients, etc. Dual quad core Xeon, 16GB RAM and lots of drive space. This machine was too much to waste on a single installation of Linux so I decided it was time to learn virtualization and Xen in particular.

Xen is a hypervisor that makes it possible to run multiple operating systems on one machine as though it were multiple machines. Basically it allows you to make one computer look like a whole bunch of computers. Each "computer" can even run a different operating system.

Creating a UI Component in Struts 2

Categories: | |


You have a form "element" that consists of several HTML actual elements. You'd like to create these using one Struts 2 UI tag, rather then write the HTML out everywhere it's needed.


The Struts 2 UI tag library provide a component tag, which can be used to create your own "tags" without needing to dive into the JSP tag library API. Creating a tag using the Struts 2 component tag, also allows it to directly take advantage of the Struts 2 framework, such as OGNL support, and the existing Struts 2 UI tag themes.


In this recipe we will creating an HTML control using the component tag that will display two input fields. This is a simple example, but it will show the process of creating a component, and tying it into the existing Struts 2 Xhtml theme.

Creating a Theme in Struts 2

Categories: |

Struts 2 has a very powerful set of user interface tags (UI Tags). These tags are tightly integrated with the framework, taking full advantage of things like the OGNL Value Stack. The power this gives to a user it tremendous.

Struts 2 UI Tags

The Struts 2 UI Tags are backed with templates that do the actual rendering of HTML. You can change them without any need to touch the implementing classes. As of Struts 2.0.2 these templates are written in the FreeMarker template language. A quick look at the Freemarker Manual will provide you a quick overview of the language, and is helpful if you have questions about the language. Anyone familiar with JSP, PHP, or other template languages can quickly grasp it.

Using a Conversation Scope in Struts 2

Categories: | | |

What is a conversation scope?

A conversation scope fits between a Session scope and a Request scope in J2EE terms. An object in a session is specific to a particular user of a web app. If you place an object in the users session it will be available on every page hit the user makes.

A conversation scope defines a long lived set of data that is specific to a process, such as configuring a product, or filling out a customers personal and credit information. It differs from a session scope in that one user should be able to have multiple of th same type of conversation at the same time. You might actually have to help more than one customer at a time, or configure multiple products, one on each tab in your web browser.

Updating a List of Domain Entities in Struts 2

Categories: | | |

I've been working on Quadran a lot, and I'm creating pages for editing lists of entities. The CRUD example from the Struts 2 Showcase application does this in a very simple manner. It recreates all of the entities every time you update the list. That's fine for an example but unusable in real life.

In real life we have to present entities from our database and then put the values back into the same entities, and update our database. We can't just re-create them.

The Entity

So, we'll start with a simple domain object and assume that we're using something like JPA or Hibernate to persist it via a Data Access Object (DAO), and that it contains a property called "id".

Syndicate content