Spring Roo 1.0.2 Selenium Fix

Posted by: on Mar 16, 2010 | No Comments

If you are jumping into Spring Roo and you have downloaded the latest 1.0.2 release in order to follow the ten minute test, then you will encounter an issue if you are running Firefox 3.6 on Mac OS X Snow Leopard.

The step that executes “mvn selenium:selenese” will fail due to an incompatible version of sqlliblite3.dylib in the Firefox. After searching the forums and finding various solutions that didn’t work for me, I went into the pom.xml in my “ten-minutes” Roo project and updated the Selenium version to 1.0.1. After this update, Selenium was able to execute Firefox correctly. A snippet of my pom.xml maven file is below.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
     <artifactId>selenium-maven-plugin</artifactId>
     <version>1.0.1</version>
     <configuration>
      <suite>src/main/webapp/selenium/test-suite.xhtml</suite>
      <browser>*firefox</browser>
      <results>
            ${project.build.directory}/target/selenium.txt
        </results>
      <startURL>http://localhost:4444/</startURL>
     </configuration>
</plugin>

Of course, this is only a temporary fix until the Roo project updates the referenced Selenium version.

Spring FormTag CommandName vs. ModelAttribute

Posted by: on Aug 25, 2009 | No Comments

While using the <form:form> tag in Spring 3.0, I came across two confusing attributes. One is “commandName” and the other is “modelAttribute.” More recent api docs mention modelAttribute as the correct attribute for setting the name of the form context object to what is placed in the model by a controller. However, the Spring Reference manual still mentioned commandAttribute at the time of writing.

The beauty of open source is that it always serves as the most correct document. From the current 3.0M4 source you can see. This is a concrete example of why I prefer open source software.

	/**
	 * Set the name of the form attribute in the model.
	 * <p>May be a runtime expression.
	 * @see #setModelAttribute
	 */
	public void setCommandName(String commandName) {
		this.modelAttribute = commandName;
	}

I traced this back to revision 15285 in Spring Maintainance (https://src.springframework.org/svn/spring-maintenance/trunk/src/org/springframework/web/servlet/tags/form/FormTag.java). ModelAttribute supersedes CommandAttribute.

Here is the correct usage of the tag:

<form:form modelAttribute="user">
  <table>
    <tr>
      <td>First Name:</td>
      <td>
        <input path="firstName"/>
      </td>
    </tr>
    <tr>
      <td>Last Name:</td>
      <td>
        <input path="lastName"/>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <input type="submit" value="Save Changes"/>
      </td>
    </tr>
  </table>
</form:form>